@Target(value={TYPE,METHOD,ANNOTATION_TYPE}) @Retention(value=RUNTIME) public @interface KafkaStreamsStateStore
@StreamListener("input")
@KafkaStreamsStateStore(name="mystate", type= KafkaStreamsStateStoreProperties.StoreType.WINDOW,
size=300000)
public void process(KStream<Object, Product> input) {
......
}
With that, you should be able to read/write this state store in your
processor/transformer code.
new Processor<Object, Product>() {
WindowStore<Object, String> state;
@Override
public void init(ProcessorContext processorContext) {
state = (WindowStore)processorContext.getStateStore("mystate");
......
}
}
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
cache
Whether catching is enabled or not.
|
String |
keySerde
Serde used for key.
|
long |
lengthMs
Length in milli-second of Windowed store window.
|
boolean |
logging
Whether logging is enabled or not.
|
String |
name
Provides name of the state store.
|
long |
retentionMs
Retention period for Windowed store windows.
|
KafkaStreamsStateStoreProperties.StoreType |
type
State store type.
|
String |
valueSerde
Serde used for value.
|
public abstract String name
public abstract KafkaStreamsStateStoreProperties.StoreType type
KafkaStreamsStateStoreProperties.StoreType of state store.public abstract String keySerde
public abstract String valueSerde
public abstract long lengthMs
public abstract long retentionMs
Copyright © 2022 Pivotal Software, Inc.. All rights reserved.