Kafka Streams Processor API: Write directly to kafka statestore and then to topic to avoid latency

Viewed 271

I have an application which produces to a topic. In the same application, I query its materialized state store for getting the latest value for a particular key.

I have to immediately query the state store as soon as the data is produced to the topic. Most of the time, the interactive query returns old value as it would take some time for updating the value in state store.

I am thinking of changing the architecture and I would like to know if it possible to write directly to state store first and then to final topic so that I can get the updated value as soon as it is available. If this is possible and say I have multiple instances of the same application, how can I query the local state store of other instances as I might not have a source stream?

I know interactive queries work on top of a Kafka stream with source topic. But in my case, if I directly write to a statestore, will rpc work?How can I achieve it?

Any help is much appreciated.

0 Answers
Related