public interface StateRestoreListener When calling KafkaStreams.setGlobalStateRestoreListener(StateRestoreListener) the passed instance is expected to be stateless since the StateRestoreListener is shared across all StreamThread instances.
Users desiring stateful operations will need to provide synchronization internally in the StateRestorerListener implementation.
Note that this listener is only registered at the per-client level and users can base on the storeName parameter to define specific monitoring for different StateStores. There is another StateRestoreCallback interface which is registered via the StateStoreContext.register(StateStore, StateRestoreCallback, CommitCallback) function per-store, and it is used to apply the fetched changelog records into the local state store during restoration. These two interfaces serve different restoration purposes and users should not try to implement both of them in a single class during state store registration.
Also note that the update process of standby tasks is not monitored via this interface, since a standby task does note actually
Incremental updates are exposed so users can estimate how much progress has been made.
| Modifier and Type | Method and Description |
|---|---|
void | onBatchRestored(org.apache.kafka.common.TopicPartition topicPartition, String storeName, long batchEndOffset, long numRestored)Method called after restoring a batch of records. |
void | onRestoreEnd(org.apache.kafka.common.TopicPartition topicPartition, String storeName, long totalRestored)Method called when restoring the StateStore is complete. |
void | onRestoreStart(org.apache.kafka.common.TopicPartition topicPartition, String storeName, long startingOffset, long endingOffset)Method called at the very beginning of StateStore restoration. |
default void | onRestoreSuspended(org.apache.kafka.common.TopicPartition topicPartition, String storeName, long totalRestored)Method called when restoring the StateStore is suspended due to the task being migrated out of the host. |
void onRestoreStart(org.apache.kafka.common.TopicPartition topicPartition,
String storeName,
long startingOffset,
long endingOffset)StateStore restoration.topicPartition - the TopicPartition containing the values to restorestoreName - the name of the store undergoing restorationstartingOffset - the starting offset of the entire restoration process for this TopicPartitionendingOffset - the exclusive ending offset of the entire restoration process for this TopicPartitionvoid onBatchRestored(org.apache.kafka.common.TopicPartition topicPartition,
String storeName,
long batchEndOffset,
long numRestored)topicPartition - the TopicPartition containing the values to restorestoreName - the name of the store undergoing restorationbatchEndOffset - the inclusive ending offset for the current restored batch for this TopicPartitionnumRestored - the total number of records restored in this batch for this TopicPartitionvoid onRestoreEnd(org.apache.kafka.common.TopicPartition topicPartition,
String storeName,
long totalRestored)StateStore is complete.topicPartition - the TopicPartition containing the values to restorestoreName - the name of the store just restoredtotalRestored - the total number of records restored for this TopicPartitiondefault void onRestoreSuspended(org.apache.kafka.common.TopicPartition topicPartition,
String storeName,
long totalRestored)StateStore is suspended due to the task being migrated out of the host. If the migrated task is recycled or re-assigned back to the current host, another onRestoreStart(TopicPartition, String, long, long) would be called.topicPartition - the TopicPartition containing the values to restorestoreName - the name of the store just restoredtotalRestored - the total number of records restored for this TopicPartition before being paused