Class AbstractNotifyingBatchingRestoreCallback
- java.lang.Object
-
- org.apache.kafka.streams.processor.AbstractNotifyingBatchingRestoreCallback
-
- All Implemented Interfaces:
BatchingStateRestoreCallback,StateRestoreCallback,StateRestoreListener
public abstract class AbstractNotifyingBatchingRestoreCallback extends java.lang.Object implements BatchingStateRestoreCallback, StateRestoreListener
Abstract implementation of theBatchingStateRestoreCallbackused for batch restoration operations. Includes default no-op methods of theStateRestoreListenerStateRestoreListener.onRestoreStart(TopicPartition, String, long, long),StateRestoreListener.onBatchRestored(TopicPartition, String, long, long), andStateRestoreListener.onRestoreEnd(TopicPartition, String, long).
-
-
Constructor Summary
Constructors Constructor Description AbstractNotifyingBatchingRestoreCallback()
-
Method Summary
All Methods Instance Methods Concrete 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.voidrestore(byte[] key, byte[] value)Single put restore operations not supported, please useAbstractNotifyingRestoreCallbackorStateRestoreCallbackinstead for single action restores.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.kafka.streams.processor.BatchingStateRestoreCallback
restoreAll
-
-
-
-
Method Detail
-
restore
public void restore(byte[] key, byte[] value)Single put restore operations not supported, please useAbstractNotifyingRestoreCallbackorStateRestoreCallbackinstead for single action restores.- Specified by:
restorein interfaceStateRestoreCallback
-
onRestoreStart
public void onRestoreStart(org.apache.kafka.common.TopicPartition topicPartition, java.lang.String storeName, long startingOffset, long endingOffset)Description copied from interface:StateRestoreListenerMethod called at the very beginning ofStateStorerestoration.- Specified by:
onRestoreStartin interfaceStateRestoreListener- 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- See Also:
This method does nothing by default; if desired, subclasses should override it with custom functionality.
-
onBatchRestored
public void onBatchRestored(org.apache.kafka.common.TopicPartition topicPartition, java.lang.String storeName, long batchEndOffset, long numRestored)Description copied from interface:StateRestoreListenerMethod 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.- Specified by:
onBatchRestoredin interfaceStateRestoreListener- 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- See Also:
This method does nothing by default; if desired, subclasses should override it with custom functionality.
-
onRestoreEnd
public void onRestoreEnd(org.apache.kafka.common.TopicPartition topicPartition, java.lang.String storeName, long totalRestored)Description copied from interface:StateRestoreListenerMethod called when restoring theStateStoreis complete.- Specified by:
onRestoreEndin interfaceStateRestoreListener- 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- See Also:
This method does nothing by default; if desired, subclasses should override it with custom functionality.
-
-