From: Kai Moritz Date: Sat, 11 Feb 2023 14:38:03 +0000 (+0100) Subject: counter: Introduced parameters for the config, that is needed by the test X-Git-Tag: counter-tests-instances~8 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=1eada00db1c67936e7b5067a65a80207ce01f5f3;p=demos%2Fkafka%2Fwordcount counter: Introduced parameters for the config, that is needed by the test --- diff --git a/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplication.java b/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplication.java index 6a6a78c..5fc183c 100644 --- a/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplication.java +++ b/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplication.java @@ -35,8 +35,10 @@ public class CounterApplication propertyMap.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.StringSerde.class.getName()); propertyMap.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.StringSerde.class.getName()); propertyMap.put(StreamsConfig.STATE_DIR_CONFIG, "target"); - propertyMap.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, 0); - propertyMap.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 0); + if (properties.getCommitInterval() != null) + propertyMap.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, properties.getCommitInterval()); + if (properties.getCacheMaxBytes() != null) + propertyMap.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, properties.getCacheMaxBytes()); propertyMap.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); CounterStreamProcessor streamProcessor = new CounterStreamProcessor( diff --git a/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplicationProperties.java b/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplicationProperties.java index 351ea18..c3ada17 100644 --- a/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplicationProperties.java +++ b/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplicationProperties.java @@ -17,4 +17,6 @@ public class CounterApplicationProperties private String applicationId = "counter"; private String inputTopic = "words"; private String outputTopic = "countings"; + private Integer commitInterval; + private Integer cacheMaxBytes; } diff --git a/src/test/java/de/juplo/kafka/wordcount/counter/CounterApplicationIT.java b/src/test/java/de/juplo/kafka/wordcount/counter/CounterApplicationIT.java index 3e47ebe..f15404e 100644 --- a/src/test/java/de/juplo/kafka/wordcount/counter/CounterApplicationIT.java +++ b/src/test/java/de/juplo/kafka/wordcount/counter/CounterApplicationIT.java @@ -29,6 +29,8 @@ import static org.awaitility.Awaitility.*; properties = { "spring.kafka.bootstrap-servers=${spring.embedded.kafka.brokers}", "juplo.wordcount.counter.bootstrap-server=${spring.embedded.kafka.brokers}", + "juplo.wordcount.counter.commit-interval=0", + "juplo.wordcount.counter.cacheMaxBytes=0", "juplo.wordcount.counter.input-topic=" + TOPIC_IN, "juplo.wordcount.counter.output-topic=" + TOPIC_OUT }) @EmbeddedKafka(topics = { TOPIC_IN, TOPIC_OUT }, partitions = PARTITIONS)