I have a SpringBoot application with two stream processors mapped via Spring Cloud. Each processor has own @StreamListener for different topics. One processor writes aggregated data to the quarable state store. I facing the problem in my Unit test when fetching data through my @Service (Service get aggregated data from state store). For some reason from time to time catch exception:
org.apache.kafka.streams.errors.InvalidStateStoreException: the state store, recently-played-store, may have migrated to another instance.
at org.apache.kafka.streams.state.internals.QueryableStoreProvider.getStore(QueryableStoreProvider.java:60)
at org.apache.kafka.streams.KafkaStreams.store(KafkaStreams.java:1043)
at org.springframework.cloud.stream.binder.kafka.streams.QueryableStoreRegistry.getQueryableStoreType(QueryableStoreRegistry.java:47)
When I remove StreamListener from another processor all works fine and stable.
How to bind state store for exact instance with proper Processor?