1
votes

What's an «idiomatic» way of configuring (providing host and port info) and accessing Interactive Queries in Kafka Streams + Spring Boot application?

What's the correct way to access KafkaStreams instance to access the state stores?

I'm aware of InteractiveQueriesService in spring-cloud-stream but I wasn't to use just spring-kafka library with Spring Boot.

Thank you

1

1 Answers

1
votes

Spring Boot auto-configures Kafka Streams support: https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-kafka-streams.

The infrastructure underneath is hidden in the StreamsBuilderFactoryBean. See Spring for Apache Kafka docs: https://docs.spring.io/spring-kafka/docs/2.6.2/reference/html/#streams-spring

So, you indeed can get access into that spawn KafkaStreams instance using API StreamsBuilderFactoryBean.getKafkaStreams().

There is no high-level support for Interactive Queries, but probably having access to that KafkaStreams instance, it should not be so hard for you to go ahead with state stores interaction. Looks like that InteractiveQueryService is just a delegation to KafkaStreams.