counter: 1.1.5 - Fixed a bug in the integration-test `CounterApplicationIT`
[demos/kafka/wordcount] / src / main / java / de / juplo / kafka / wordcount / counter / CounterApplication.java
index 5fc183c..20cb4d2 100644 (file)
@@ -5,6 +5,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.kafka.clients.consumer.ConsumerConfig;
 import org.apache.kafka.common.serialization.Serdes;
 import org.apache.kafka.streams.StreamsConfig;
+import org.apache.kafka.streams.state.KeyValueBytesStoreSupplier;
+import org.apache.kafka.streams.state.Stores;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -25,6 +27,7 @@ public class CounterApplication
        @Bean(initMethod = "start", destroyMethod = "stop")
        public CounterStreamProcessor streamProcessor(
                        CounterApplicationProperties properties,
+                       KeyValueBytesStoreSupplier storeSupplier,
                        ObjectMapper objectMapper,
                        ConfigurableApplicationContext context)
        {
@@ -45,6 +48,7 @@ public class CounterApplication
                                properties.getInputTopic(),
                                properties.getOutputTopic(),
                                propertyMap,
+                               storeSupplier,
                                objectMapper);
 
                streamProcessor.streams.setUncaughtExceptionHandler((Throwable e) ->
@@ -62,6 +66,12 @@ public class CounterApplication
                return streamProcessor;
        }
 
+       @Bean
+       public KeyValueBytesStoreSupplier storeSupplier()
+       {
+               return Stores.persistentKeyValueStore("counter");
+       }
+
        public static void main(String[] args)
        {
                SpringApplication.run(CounterApplication.class, args);