From bf9cd122aed44aecb04f826c09c5e5d0ea12e464 Mon Sep 17 00:00:00 2001
From: lorenz <stu203404@mail.uni-kiel.de>
Date: Fri, 16 Apr 2021 14:04:12 +0200
Subject: [PATCH] Add forgotten deletion

---
 .../src/main/kotlin/theodolite/k8s/TopicManager.kt            | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt
index 321fa9a94..a956f8218 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)
-- 
GitLab