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 T
delegate
protected ListenerType
delegateType
protected org.springframework.core.log.LogAccessor
logger
-
Constructor Summary
Constructors Constructor Description AbstractDelegatingMessageListenerAdapter(T delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getDelegate()
Return the delegate.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.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.void
onPartitionsRevoked(java.util.Collection<org.apache.kafka.common.TopicPartition> partitions)
When using group management, called when partition assignments are revoked.void
registerSeekCallback(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
onFirstPoll, 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:DelegatingMessageListener
Return the delegate.- Specified by:
getDelegate
in interfaceDelegatingMessageListener<T>
- Returns:
- the delegate.
-
registerSeekCallback
public void registerSeekCallback(ConsumerSeekAware.ConsumerSeekCallback callback)
Description copied from interface:ConsumerSeekAware
Register the callback to use when seeking at some arbitrary time. When used with aConcurrentMessageListenerContainer
or the same listener instance in multiple containers listeners should store the callback in aThreadLocal
.- Specified by:
registerSeekCallback
in 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:ConsumerSeekAware
When using group management, called when partition assignments change.- Specified by:
onPartitionsAssigned
in 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:ConsumerSeekAware
When using group management, called when partition assignments are revoked. Listeners should discard any callback saved fromConsumerSeekAware.registerSeekCallback(ConsumerSeekCallback)
on this thread.- Specified by:
onPartitionsRevoked
in 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:ConsumerSeekAware
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.- Specified by:
onIdleContainer
in interfaceConsumerSeekAware
- Parameters:
assignments
- the new assignments and their current offsets.callback
- the callback to perform a seek.
-
-