Interface StateRestoreListener
-
- All Known Implementing Classes:
AbstractNotifyingBatchingRestoreCallback,AbstractNotifyingRestoreCallback
public interface StateRestoreListenerClass for listening to various states of the restoration process of a StateStore. When callingKafkaStreams.setGlobalStateRestoreListener(StateRestoreListener)the passed instance is expected to be stateless since theStateRestoreListeneris shared across allStreamThreadinstances. Users desiring stateful operations will need to provide synchronization internally in theStateRestorerListenerimplementation. When used for monitoring a singleStateStoreusing eitherAbstractNotifyingRestoreCallbackorAbstractNotifyingBatchingRestoreCallbackno synchronization is necessary as each StreamThread has its own StateStore instance. Incremental updates are exposed so users can estimate how much progress has been made.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonBatchRestored(org.apache.kafka.common.TopicPartition topicPartition, java.lang.String storeName, long batchEndOffset, long numRestored)Method called after restoring a batch of records.voidonRestoreEnd(org.apache.kafka.common.TopicPartition topicPartition, java.lang.String storeName, long totalRestored)Method called when restoring theStateStoreis complete.voidonRestoreStart(org.apache.kafka.common.TopicPartition topicPartition, java.lang.String storeName, long startingOffset, long endingOffset)Method called at the very beginning ofStateStorerestoration.
-
-
-
Method Detail
-
onRestoreStart
void onRestoreStart(org.apache.kafka.common.TopicPartition topicPartition, java.lang.String storeName, long startingOffset, long endingOffset)Method called at the very beginning ofStateStorerestoration.- Parameters:
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 TopicPartition
-
onBatchRestored
void onBatchRestored(org.apache.kafka.common.TopicPartition topicPartition, java.lang.String storeName, long batchEndOffset, long numRestored)Method called after restoring a batch of records. In this case the maximum size of the batch is whatever the value of the MAX_POLL_RECORDS is set to. This method is called after restoring each batch and it is advised to keep processing to a minimum. Any heavy processing will hold up recovering the next batch, hence slowing down the restore process as a whole. If you need to do any extended processing or connecting to an external service consider doing so asynchronously.- Parameters:
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 TopicPartition
-
onRestoreEnd
void onRestoreEnd(org.apache.kafka.common.TopicPartition topicPartition, java.lang.String storeName, long totalRestored)Method called when restoring theStateStoreis complete.- Parameters:
topicPartition- the TopicPartition containing the values to restorestoreName- the name of the store just restoredtotalRestored- the total number of records restored for this TopicPartition
-
-