import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerConfig;
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.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
public Top10StreamProcessor streamProcessor(
Top10ApplicationProperties applicationProperties,
Properties streamProcessorProperties,
+ KeyValueBytesStoreSupplier storeSupplier,
ConfigurableApplicationContext context)
{
Top10StreamProcessor streamProcessor = new Top10StreamProcessor(
applicationProperties.getInputTopic(),
applicationProperties.getOutputTopic(),
- streamProcessorProperties);
+ streamProcessorProperties,
+ storeSupplier);
streamProcessor.streams.setUncaughtExceptionHandler((Throwable e) ->
{
return streamProcessor;
}
+
+ @Bean
+ public KeyValueBytesStoreSupplier storeSupplier()
+ {
+ return Stores.persistentKeyValueStore("top10");
+ }
}