Accessing Kafka Stream State Store with Spring

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Accessing Kafka Stream State Store with Spring



Referencing 4.2.6 of this doc https://docs.spring.io/spring-kafka/reference/htmlsingle/#kafka-streams



How do you get access to state stores using kafka stream spring support?



Without spring you could do?


StreamsBuilder builder = ...;
// Start an instance of the topology
KafkaStreams streams = new KafkaStreams(builder, config);

...

// Get the key-value store CountsKeyValueStore
ReadOnlyKeyValueStore<String, Long> keyValueStore =
streams.store("CountsKeyValueStore", QueryableStoreTypes.keyValueStore());



But I am not sure how to gain acess to KafkaStreams object.




1 Answer
1



Autowire the StreamsBuilderFactoryBean (or otherwise get a reference to it from the application context) and call getKafkaStreams().


StreamsBuilderFactoryBean


getKafkaStreams()






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard