Skip to content
Snippets Groups Projects
Commit c0877a5e authored by Sören Henning's avatar Sören Henning
Browse files

Minor code style fixes

parent 50fcca86
No related branches found
No related tags found
3 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
...@@ -18,16 +18,16 @@ dependencies { ...@@ -18,16 +18,16 @@ dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'io.quarkus:quarkus-arc' implementation 'io.quarkus:quarkus-arc'
implementation 'io.quarkus:quarkus-resteasy' implementation 'io.quarkus:quarkus-resteasy'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.google.code.gson:gson:2.8.5'
implementation 'org.slf4j:slf4j-simple:1.7.29' implementation 'org.slf4j:slf4j-simple:1.7.29'
implementation 'io.github.microutils:kotlin-logging:1.12.0' implementation 'io.github.microutils:kotlin-logging:1.12.0'
implementation 'io.fabric8:kubernetes-client:5.0.0-alpha-2' implementation 'io.fabric8:kubernetes-client:5.0.0-alpha-2'
implementation 'io.quarkus:quarkus-kubernetes-client' implementation 'io.quarkus:quarkus-kubernetes-client'
implementation 'org.apache.kafka:kafka-clients:2.7.0' implementation 'org.apache.kafka:kafka-clients:2.7.0'
implementation 'khttp:khttp:1.0.0' implementation 'khttp:khttp:1.0.0'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
} }
group 'theodolite' group 'theodolite'
......
...@@ -11,13 +11,14 @@ private const val RETRY_TIME = 2000L ...@@ -11,13 +11,14 @@ private const val RETRY_TIME = 2000L
/** /**
* Manages the topics related tasks * Manages the topics related tasks
* @param kafkaConfig Kafka Configuration as HashMap * @param kafkaConfig Kafka configuration as a Map
* @constructor Creates a KafkaAdminClient * @constructor Creates a KafkaAdminClient
*/ */
class TopicManager(private val kafkaConfig: HashMap<String, Any>) { class TopicManager(private val kafkaConfig: Map<String, Any>) {
/** /**
* Creates topics. * Create topics.
* @param newTopics List of all Topic that should be created * @param newTopics Collection of all topic that should be created
*/ */
fun createTopics(newTopics: Collection<NewTopic>) { fun createTopics(newTopics: Collection<NewTopic>) {
val kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig) val kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig)
...@@ -27,7 +28,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) { ...@@ -27,7 +28,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
var retryCreation = false var retryCreation = false
try { try {
result = kafkaAdmin.createTopics(newTopics) result = kafkaAdmin.createTopics(newTopics)
result.all().get()// wait for the future object result.all().get() // wait for the future to be completed
} catch (e: Exception) { } catch (e: Exception) {
delete(newTopics.map { topic -> topic.name() }, kafkaAdmin) delete(newTopics.map { topic -> topic.name() }, kafkaAdmin)
...@@ -49,8 +50,8 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) { ...@@ -49,8 +50,8 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
} }
/** /**
* Removes topics. * Remove topics.
* @param topics List of names with the topics to remove. * @param topics Collection of names for the topics to remove.
*/ */
fun removeTopics(topics: List<String>) { fun removeTopics(topics: List<String>) {
val kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig) val kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig)
...@@ -64,7 +65,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) { ...@@ -64,7 +65,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
while (!deleted) { while (!deleted) {
try { try {
val result = kafkaAdmin.deleteTopics(topics) val result = kafkaAdmin.deleteTopics(topics)
result.all().get() // wait for the future object result.all().get() // wait for the future to be completed
logger.info { logger.info {
"Topics deletion finished with result: ${ "Topics deletion finished with result: ${
result.values().map { it -> it.key + ": " + it.value.isDone } result.values().map { it -> it.key + ": " + it.value.isDone }
......
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