Question 1 : I read that all the stateful operations of Kafka Streams ( Eg. Aggregate, Count etc.) create a state store on the client instance. What is the difference when we use Materialized.with or Materialized.as along with stateful operation. Is it only for interactive queries? Or Is there anything else which goes on internally when we just call stateful operation vs calling stateful operation with Materialized views?
Question 2: What happens internally when num.standby.replicas > 0 ? Is the changelog topic replicated or only the state store is replicated? How does the replica pick up the changes? How does the replication take place?
What is the difference when we use Materialized.with or Materialized.as along with stateful operation.
Materializes.as()
set a store name an thus enable the store for interactive queries It also impact the name of the underlying changelog topic thus you should not change it for an already deployed application. Beside that, there is no difference.
What happens internally when num.standby.replicas > 0 ? Is the changelog topic replicated or only the state store is replicated?
The changelog topic is replicated based on the broker/topic configuration replication.factor
. The number of standby tasks is not related to changelog topic replication, but only for client side state store replication. Standby task, read the changelog topic (that the active task writes) to maintain the replicated state.