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 java.lang.Object implements ConsumerSeekAware, DelegatingMessageListener<T>
Top level class for all listener adapters.- Since:
- 1.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.springframework.kafka.listener.ConsumerSeekAware
ConsumerSeekAware.ConsumerSeekCallback
-
-
Field Summary
Fields Modifier and Type Field Description protected Tdelegateprotected ListenerTypedelegateTypeprotected org.springframework.core.log.LogAccessorlogger
-
Constructor Summary
Constructors Constructor Description AbstractDelegatingMessageListenerAdapter(T delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TgetDelegate()Return the delegate.voidonIdleContainer(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.voidonPartitionsAssigned(java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> assignments, ConsumerSeekAware.ConsumerSeekCallback callback)When using group management, called when partition assignments change.voidonPartitionsRevoked(java.util.Collection<org.apache.kafka.common.TopicPartition> partitions)When using group management, called when partition assignments are revoked.voidregisterSeekCallback(ConsumerSeekAware.ConsumerSeekCallback callback)Register 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, wait
-
Methods inherited from interface org.springframework.kafka.listener.ConsumerSeekAware
unregisterSeekCallback
-
-
-
-
Field Detail
-
logger
protected final org.springframework.core.log.LogAccessor logger
-
delegate
protected final T delegate
-
delegateType
protected final ListenerType delegateType
-
-
Constructor Detail
-
AbstractDelegatingMessageListenerAdapter
public AbstractDelegatingMessageListenerAdapter(T delegate)
-
-
Method Detail
-
getDelegate
public T getDelegate()
Description copied from interface:DelegatingMessageListenerReturn the delegate.- Specified by:
getDelegatein interfaceDelegatingMessageListener<T>- Returns:
- the delegate.
-
registerSeekCallback
public void registerSeekCallback(ConsumerSeekAware.ConsumerSeekCallback callback)
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(java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.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
public void onPartitionsRevoked(java.util.Collection<org.apache.kafka.common.TopicPartition> partitions)
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(java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.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.
-
-