Class AbstractDelegatingMessageListenerAdapter<T>
java.lang.Object
org.springframework.kafka.listener.adapter.AbstractDelegatingMessageListenerAdapter<T>
- Type Parameters:
T- the delegate type.
- All Implemented Interfaces:
ConsumerSeekAware,DelegatingMessageListener<T>
- Direct Known Subclasses:
AbstractFilteringMessageListener,AbstractRetryingMessageListenerAdapter,KafkaBackoffAwareMessageListenerAdapter
public abstract class AbstractDelegatingMessageListenerAdapter<T>
extends Object
implements ConsumerSeekAware, DelegatingMessageListener<T>
Top level class for all listener adapters.
- Since:
- 1.1
- Author:
- Gary Russell
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.kafka.listener.ConsumerSeekAware
ConsumerSeekAware.ConsumerSeekCallback -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Tprotected final ListenerTypeprotected final LogAccessor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the delegate.voidonIdleContainer(Map<org.apache.kafka.common.TopicPartition, 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.voidonPartitionsAssigned(Map<org.apache.kafka.common.TopicPartition, Long> assignments, ConsumerSeekAware.ConsumerSeekCallback callback) When using group management, called when partition assignments change.voidonPartitionsRevoked(Collection<org.apache.kafka.common.TopicPartition> partitions) When using group management, called when partition assignments are revoked.voidRegister the callback to use when seeking at some arbitrary time.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.kafka.listener.ConsumerSeekAware
onFirstPoll, unregisterSeekCallback
-
Field Details
-
logger
-
delegate
-
delegateType
-
-
Constructor Details
-
AbstractDelegatingMessageListenerAdapter
-
-
Method Details
-
getDelegate
Description copied from interface:DelegatingMessageListenerReturn the delegate.- Specified by:
getDelegatein interfaceDelegatingMessageListener<T>- Returns:
- the delegate.
-
registerSeekCallback
Description copied from interface:ConsumerSeekAwareRegister the callback to use when seeking at some arbitrary time. When used with aConcurrentMessageListenerContaineror the same listener instance in multiple containers listeners should store the callback in aThreadLocal.- Specified by:
registerSeekCallbackin interfaceConsumerSeekAware- Parameters:
callback- the callback.
-
onPartitionsAssigned
public void onPartitionsAssigned(Map<org.apache.kafka.common.TopicPartition, Long> assignments, ConsumerSeekAware.ConsumerSeekCallback callback) Description copied from interface:ConsumerSeekAwareWhen using group management, called when partition assignments change.- Specified by:
onPartitionsAssignedin interfaceConsumerSeekAware- Parameters:
assignments- the new assignments and their current offsets.callback- the callback to perform an initial seek after assignment.
-
onPartitionsRevoked
Description copied from interface:ConsumerSeekAwareWhen using group management, called when partition assignments are revoked. Listeners should discard any callback saved fromConsumerSeekAware.registerSeekCallback(ConsumerSeekCallback)on this thread.- Specified by:
onPartitionsRevokedin interfaceConsumerSeekAware- Parameters:
partitions- the partitions that have been revoked.
-
onIdleContainer
public void onIdleContainer(Map<org.apache.kafka.common.TopicPartition, Long> assignments, ConsumerSeekAware.ConsumerSeekCallback callback) Description copied from interface:ConsumerSeekAwareIf the container is configured to emit idle container events, this method is called when the container idle event is emitted - allowing a seek operation.- Specified by:
onIdleContainerin interfaceConsumerSeekAware- Parameters:
assignments- the new assignments and their current offsets.callback- the callback to perform a seek.
-