Interface StandbyUpdateListener


public interface StandbyUpdateListener
  • Method Details

    • onUpdateStart

      void onUpdateStart(TopicPartition topicPartition, String storeName, long startingOffset)
      A callback that will be invoked after registering the changelogs for each state store in a standby task. It is guaranteed to always be invoked before any records are loaded into the standby store.
      Parameters:
      topicPartition - the changelog TopicPartition for this standby task
      storeName - the name of the store being loaded
      startingOffset - the offset from which the standby task begins consuming from the changelog
    • onBatchLoaded

      void onBatchLoaded(TopicPartition topicPartition, String storeName, TaskId taskId, long batchEndOffset, long batchSize, long currentEndOffset)
      Method called after loading 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 loading each batch and it is advised to keep processing to a minimum. Any heavy processing will block the state updater thread and slow down the rate of standby task loading. Therefore, if you need to do any extended processing or connect to an external service, consider doing so asynchronously.
      Parameters:
      topicPartition - the changelog TopicPartition for this standby task
      storeName - the name of the store being loaded
      batchEndOffset - batchEndOffset the changelog end offset (inclusive) of the batch that was just loaded
      batchSize - the total number of records in the batch that was just loaded
      currentEndOffset - the current end offset of the changelog topic partition.
    • onUpdateSuspended

      void onUpdateSuspended(TopicPartition topicPartition, String storeName, long storeOffset, long currentEndOffset, StandbyUpdateListener.SuspendReason reason)
      This method is called when the corresponding standby task stops updating, for the provided reason.

      If the task was MIGRATED to another instance, this callback will be invoked after this state store (and the task itself) are closed (in which case the data will be cleaned up after state.cleanup.delay.ms). If the task was PROMOTED to an active task, the state store will not be closed, and the callback will be invoked after unregistering it as a standby task but before re-registering it as an active task and beginning restoration. In other words, this will always called before the corresponding StateRestoreListener.onRestoreStart(org.apache.kafka.common.TopicPartition, java.lang.String, long, long) call is made.

      Parameters:
      topicPartition - the changelog TopicPartition for this standby task
      storeName - the name of the store being loaded
      storeOffset - is the offset of the last changelog record that was read and put into the store at the time of suspension.
      currentEndOffset - the current end offset of the changelog topic partition.
      reason - is the reason why the standby task was suspended.