Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
public interface BatchingStateRestoreCallback extends StateRestoreCallback {

   void restoreAll(Collection<KeyValue<byte[], byte []>> records);
 
   StateRestoreListener getStateRestoreListener();
}
 
 
public interface StateRestoreListener {

    void onRestoreStart(String storeName, long startingOffset, long endOffset);

    void onBatchRestored(String storeName, long batchEndOffset, long numRestored);

    void onRestoreEnd(String storeName, long endOffset, long totalRestored);

}

...

The idea behind the StateRestoreListener  being set on the KafkaStreams object vs a configuration parameter is it allows for implementors to have access to enclosing state when creating the listener for reporting purposes.

 

Additionally, users can specify a different StateRestoreListener implementation per restore callback by implementing the (or overriding from the provided abstract class)  getStateRestoreListener() method.  It will be assumed a return value other than null indicates the user wants to use a custom StateRestoreListener vs. the "global" on provided via the KafkaStreams.setStateRestoreListener method.

Compatibility, Deprecation, and Migration Plan

...