counter: 1.1.9 - Refactored creation of `Properties` as a separate bean counter-1.1.9
authorKai Moritz <kai@juplo.de>
Tue, 14 Feb 2023 19:17:12 +0000 (20:17 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 17 Feb 2023 16:32:28 +0000 (17:32 +0100)
pom.xml
src/main/java/de/juplo/kafka/wordcount/counter/CounterApplication.java

diff --git a/pom.xml b/pom.xml
index 93a541b..b0ca36b 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
        </parent>
        <groupId>de.juplo.kafka.wordcount</groupId>
        <artifactId>counter</artifactId>
-       <version>1.1.8</version>
+       <version>1.1.9</version>
        <name>Wordcount-Counter</name>
        <description>Word-counting stream-processor of the multi-user wordcount-example</description>
        <properties>
index 20cb4d2..31086ca 100644 (file)
@@ -24,12 +24,8 @@ import static org.apache.kafka.streams.errors.StreamsUncaughtExceptionHandler.St
 @Slf4j
 public class CounterApplication
 {
-       @Bean(initMethod = "start", destroyMethod = "stop")
-       public CounterStreamProcessor streamProcessor(
-                       CounterApplicationProperties properties,
-                       KeyValueBytesStoreSupplier storeSupplier,
-                       ObjectMapper objectMapper,
-                       ConfigurableApplicationContext context)
+       @Bean
+       public Properties propertyMap(CounterApplicationProperties properties)
        {
                Properties propertyMap = new Properties();
 
@@ -44,6 +40,17 @@ public class CounterApplication
                        propertyMap.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, properties.getCacheMaxBytes());
                propertyMap.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
 
+               return propertyMap;
+       }
+
+       @Bean(initMethod = "start", destroyMethod = "stop")
+       public CounterStreamProcessor streamProcessor(
+                       CounterApplicationProperties properties,
+                       Properties propertyMap,
+                       KeyValueBytesStoreSupplier storeSupplier,
+                       ObjectMapper objectMapper,
+                       ConfigurableApplicationContext context)
+       {
                CounterStreamProcessor streamProcessor = new CounterStreamProcessor(
                                properties.getInputTopic(),
                                properties.getOutputTopic(),