Interface ConsumerSeekAware

    • Method Detail

      • registerSeekCallback

        default void registerSeekCallback​(ConsumerSeekAware.ConsumerSeekCallback callback)
        Register the callback to use when seeking at some arbitrary time. When used with a ConcurrentMessageListenerContainer or the same listener instance in multiple containers listeners should store the callback in a ThreadLocal.
        Parameters:
        callback - the callback.
      • onPartitionsAssigned

        default void onPartitionsAssigned​(java.util.Map<org.apache.kafka.common.TopicPartition,​java.lang.Long> assignments,
                                          ConsumerSeekAware.ConsumerSeekCallback callback)
        When using group management, called when partition assignments change.
        Parameters:
        assignments - the new assignments and their current offsets.
        callback - the callback to perform an initial seek after assignment.
      • onPartitionsRevoked

        default void onPartitionsRevoked​(java.util.Collection<org.apache.kafka.common.TopicPartition> partitions)
        When using group management, called when partition assignments are revoked. Listeners should discard any callback saved from registerSeekCallback(ConsumerSeekCallback) on this thread.
        Parameters:
        partitions - the partitions that have been revoked.
        Since:
        2.3
      • onIdleContainer

        default void onIdleContainer​(java.util.Map<org.apache.kafka.common.TopicPartition,​java.lang.Long> assignments,
                                     ConsumerSeekAware.ConsumerSeekCallback callback)
        If the container is configured to emit idle container events, this method is called when the container idle event is emitted - allowing a seek operation.
        Parameters:
        assignments - the new assignments and their current offsets.
        callback - the callback to perform a seek.
      • unregisterSeekCallback

        default void unregisterSeekCallback()
        Called when the listener consumer terminates allowing implementations to clean up state, such as thread locals.
        Since:
        2.4