public interface StateStoreContext
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
appConfigs()
Returns all the application config properties as key/value pairs.
|
Map<String,Object> |
appConfigsWithPrefix(String prefix)
Returns all the application config properties with the given key prefix, as key/value pairs
stripping the prefix.
|
String |
applicationId()
Returns the application id.
|
org.apache.kafka.common.serialization.Serde<?> |
keySerde()
Returns the default key serde.
|
StreamsMetrics |
metrics()
Returns Metrics instance.
|
Optional<RecordMetadata> |
recordMetadata()
Return the metadata of the current topic/partition/offset if available.
|
void |
register(StateStore store,
StateRestoreCallback stateRestoreCallback)
Registers and possibly restores the specified storage engine.
|
void |
register(StateStore store,
StateRestoreCallback stateRestoreCallback,
CommitCallback commitCallback)
Registers and possibly restores the specified storage engine.
|
File |
stateDir()
Returns the state directory for the partition.
|
TaskId |
taskId()
Returns the task id.
|
org.apache.kafka.common.serialization.Serde<?> |
valueSerde()
Returns the default value serde.
|
String applicationId()
TaskId taskId()
Optional<RecordMetadata> recordMetadata()
Note that the metadata is not defined during all store interactions, for example, while the StreamTask is running a punctuation.
org.apache.kafka.common.serialization.Serde<?> keySerde()
org.apache.kafka.common.serialization.Serde<?> valueSerde()
File stateDir()
StreamsMetrics metrics()
void register(StateStore store, StateRestoreCallback stateRestoreCallback)
store
- the storage enginestateRestoreCallback
- the restoration callback logic for log-backed state stores upon restartIllegalStateException
- If store gets registered after initialized is already finishedStreamsException
- if the store's change log does not contain the partition@InterfaceStability.Evolving void register(StateStore store, StateRestoreCallback stateRestoreCallback, CommitCallback commitCallback)
store
- the storage enginestateRestoreCallback
- the restoration callback logic for log-backed state stores upon restartcommitCallback
- a callback to be invoked upon successful task commit, in case the store
needs to perform any state tracking when the task is known to be in
a consistent state. If the store has no such state to track, it may
use register(StateStore, StateRestoreCallback)
instead.
Persistent stores provided by Kafka Streams use this method to save
their Position information to local disk, for example.IllegalStateException
- If store gets registered after initialized is already finishedStreamsException
- if the store's change log does not contain the partitionMap<String,Object> appConfigs()
The config properties are defined in the StreamsConfig
object and associated to the StateStoreContext.
The type of the values is dependent on the type
of the property
(e.g. the value of DEFAULT_KEY_SERDE_CLASS_CONFIG
will be of type Class
, even if it was specified as a String to
StreamsConfig(Map)
).
Map<String,Object> appConfigsWithPrefix(String prefix)
The config properties are defined in the StreamsConfig
object and associated to the StateStoreContext.
prefix
- the properties prefix