[X] state stores can be added to topology though StreamBuilder.AddStateStore
NOTE: It's required to connect state stores to IProcessor<K, V> or ITransformer<K, V, K1, V1> before use it.
Example:
Add a state store
var builder = new StreamBuilder();
var storeBuilder = Stores.KeyValueStoreBuilder<K, V>(
Stores.InMemoryKeyValueStore("output-store"),
new JsonSerDes<K>(),
new JsonSerDes<V>());
builder.AddStateStore(storeBuilder);
Connect the state store with the transformer or processor by passing the store name to storeNames parameter of Process, Transform or TransformValues method:
Changes:
StreamBuilder.AddStateStore
Example:
Add a state store
Connect the state store with the transformer or processor by passing the store name to storeNames parameter of
Process
,Transform
orTransformValues
method:The state store now can be retrieved in
TTransformer.Init
and can be used later whenTTransformer.Process
is called