Skip to content
Snippets Groups Projects
Commit 95d6a38e authored by Benedikt Wetzel's avatar Benedikt Wetzel Committed by Lorenz Boguhn
Browse files

wait of the future from the kafka client

parent 5ed38dae
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!121Introduce hot fixes from the presentation branch,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
......@@ -20,9 +20,9 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
*/
fun createTopics(newTopics: Collection<NewTopic>) {
var kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig)
kafkaAdmin.createTopics(newTopics)
val result = kafkaAdmin.createTopics(newTopics)
logger.info { "Topics created finished with result: ${result.all().get()}" }
kafkaAdmin.close()
logger.info { "Topics created" }
}
......@@ -32,10 +32,10 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
*/
fun removeTopics(topics: List<String>) {
var kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig)
val result = kafkaAdmin.deleteTopics(topics)
try {
result.all().get()
val result = kafkaAdmin.deleteTopics(topics)
logger.info { "Topics deletion finished with result: ${result.all().get()}" }
} catch (e: Exception) {
logger.error { "Error while removing topics: $e" }
logger.debug { "Existing topics are: ${kafkaAdmin.listTopics()}." }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment