diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt index 321fa9a945fade012a81ea4dbacb2c403e783411..a956f8218499491fc91e1595692aa8ddcd3912d0 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt @@ -30,7 +30,9 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) { result.all().get()// wait for the future object } catch (e: Exception) { + removeTopics(newTopics.map { topic -> topic.name() }) logger.warn { "Error during topic creation." } + logger.debug { e } logger.warn { "Will retry the topic creation after 2 seconds" } sleep(RETRY_TIME) retryCreation = true @@ -53,7 +55,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) { fun removeTopics(topics: List<String>) { val kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig) var deleted = false - + while (!deleted) { try { val result = kafkaAdmin.deleteTopics(topics)