From d48c9dd5f415a418cd52e0c254d6a4983a9c1b17 Mon Sep 17 00:00:00 2001 From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de> Date: Mon, 8 Mar 2021 16:47:45 +0100 Subject: [PATCH] fix creation of Kafka topics --- .../theodolite/benchmark/KubernetesBenchmark.kt | 2 +- .../src/main/kotlin/theodolite/util/KafkaConfig.kt | 13 ++++++++++++- .../src/main/resources/yaml/testBenchmarkType.yaml | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt index 7c06856a8..cef47a556 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt @@ -46,7 +46,7 @@ class KubernetesBenchmark(): Benchmark { resources = resources.map { r -> r.second }, kafkaConfig = hashMapOf("bootstrap.servers" to kafkaConfig.bootstrapServer), zookeeperConfig = zookeeperConfig["server"].toString(), - topics = kafkaConfig.topics) + topics = kafkaConfig.getKafkaTopics()) } } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/KafkaConfig.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/KafkaConfig.kt index f75927c0e..1ad2f1b21 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/KafkaConfig.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/util/KafkaConfig.kt @@ -1,8 +1,19 @@ package theodolite.util import org.apache.kafka.clients.admin.NewTopic +import kotlin.properties.Delegates class KafkaConfig() { lateinit var bootstrapServer: String - lateinit var topics: List<NewTopic> + lateinit var topics: List<TopicWrapper> + + fun getKafkaTopics(): List<NewTopic> { + return topics.map { topic -> NewTopic(topic.name, topic.numPartitions, topic.replicationFactor) } + } + + class TopicWrapper { + lateinit var name: String + var numPartitions by Delegates.notNull<Int>() + var replicationFactor by Delegates.notNull<Short>() + } } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml b/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml index de1db3c71..dc820e465 100644 --- a/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml +++ b/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml @@ -21,7 +21,7 @@ kafkaConfig: bootstrapServer: "localhost:31290" topics: - name: "input" - partition: "1" - replication: "1" + numPartitions: 1 + replicationFactor: 1 zookeeperConfig: server: "localhost:31953" \ No newline at end of file -- GitLab