counter: Introduced parameters for the config, that is needed by the test
authorKai Moritz <kai@juplo.de>
Sat, 11 Feb 2023 14:38:03 +0000 (15:38 +0100)
committerKai Moritz <kai@juplo.de>
Sat, 11 Feb 2023 14:38:03 +0000 (15:38 +0100)
src/main/java/de/juplo/kafka/wordcount/counter/CounterApplication.java
src/main/java/de/juplo/kafka/wordcount/counter/CounterApplicationProperties.java
src/test/java/de/juplo/kafka/wordcount/counter/CounterApplicationIT.java

index 6a6a78c..5fc183c 100644 (file)
@@ -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(
index 351ea18..c3ada17 100644 (file)
@@ -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;
 }
index 3e47ebe..f15404e 100644 (file)
@@ -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)