Class RetryingMessageListenerAdapter<K,V>
- java.lang.Object
-
- org.springframework.kafka.listener.adapter.AbstractDelegatingMessageListenerAdapter<T>
-
- org.springframework.kafka.listener.adapter.AbstractRetryingMessageListenerAdapter<K,V,MessageListener<K,V>>
-
- org.springframework.kafka.listener.adapter.RetryingMessageListenerAdapter<K,V>
-
- Type Parameters:
K
- the key type.V
- the value type.
- All Implemented Interfaces:
AcknowledgingConsumerAwareMessageListener<K,V>
,ConsumerSeekAware
,DelegatingMessageListener<MessageListener<K,V>>
,GenericMessageListener<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>
,MessageListener<K,V>
@Deprecated public class RetryingMessageListenerAdapter<K,V> extends AbstractRetryingMessageListenerAdapter<K,V,MessageListener<K,V>> implements AcknowledgingConsumerAwareMessageListener<K,V>
Deprecated.since 2.8 - use a suitably configured error handler instead.A retrying message listener adapter forMessageListener
s.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.springframework.kafka.listener.ConsumerSeekAware
ConsumerSeekAware.ConsumerSeekCallback
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTEXT_ACKNOWLEDGMENT
Deprecated.RetryContext
attribute key for an acknowledgment if the listener is capable of acknowledging.static java.lang.String
CONTEXT_CONSUMER
Deprecated.RetryContext
attribute key for the consumer if the listener is consumer-aware.static java.lang.String
CONTEXT_RECORD
Deprecated.RetryContext
attribute key for the record.-
Fields inherited from class org.springframework.kafka.listener.adapter.AbstractDelegatingMessageListenerAdapter
delegate, delegateType, logger
-
-
Constructor Summary
Constructors Constructor Description RetryingMessageListenerAdapter(MessageListener<K,V> messageListener, org.springframework.retry.support.RetryTemplate retryTemplate)
Deprecated.Construct an instance with the provided template and delegate.RetryingMessageListenerAdapter(MessageListener<K,V> messageListener, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback)
Deprecated.Construct an instance with the provided template, callback and delegate.RetryingMessageListenerAdapter(MessageListener<K,V> messageListener, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback, boolean stateful)
Deprecated.Construct an instance with the provided template, callback and delegate.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data)
Deprecated.Invoked with data from kafka.void
onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data, org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
Deprecated.Invoked with data from kafka and provides access to theConsumer
.void
onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data, Acknowledgment acknowledgment)
Deprecated.Invoked with data from kafka.void
onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record, Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
Deprecated.Invoked with data from kafka and provides access to theConsumer
.-
Methods inherited from class org.springframework.kafka.listener.adapter.AbstractRetryingMessageListenerAdapter
getRecoveryCallback, getRetryTemplate
-
Methods inherited from class org.springframework.kafka.listener.adapter.AbstractDelegatingMessageListenerAdapter
getDelegate, onIdleContainer, onPartitionsAssigned, onPartitionsRevoked, registerSeekCallback
-
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
-
CONTEXT_ACKNOWLEDGMENT
public static final java.lang.String CONTEXT_ACKNOWLEDGMENT
Deprecated.RetryContext
attribute key for an acknowledgment if the listener is capable of acknowledging.- See Also:
- Constant Field Values
-
CONTEXT_CONSUMER
public static final java.lang.String CONTEXT_CONSUMER
Deprecated.RetryContext
attribute key for the consumer if the listener is consumer-aware.- See Also:
- Constant Field Values
-
CONTEXT_RECORD
public static final java.lang.String CONTEXT_RECORD
Deprecated.RetryContext
attribute key for the record.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RetryingMessageListenerAdapter
public RetryingMessageListenerAdapter(MessageListener<K,V> messageListener, org.springframework.retry.support.RetryTemplate retryTemplate)
Deprecated.Construct an instance with the provided template and delegate. The exception will be thrown to the container after retries are exhausted.- Parameters:
messageListener
- the delegate listener.retryTemplate
- the template.
-
RetryingMessageListenerAdapter
public RetryingMessageListenerAdapter(MessageListener<K,V> messageListener, org.springframework.retry.support.RetryTemplate retryTemplate, @Nullable org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback)
Deprecated.Construct an instance with the provided template, callback and delegate.- Parameters:
messageListener
- the delegate listener.retryTemplate
- the template.recoveryCallback
- the recovery callback; if null, the exception will be thrown to the container after retries are exhausted.
-
RetryingMessageListenerAdapter
public RetryingMessageListenerAdapter(MessageListener<K,V> messageListener, org.springframework.retry.support.RetryTemplate retryTemplate, @Nullable org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback, boolean stateful)
Deprecated.Construct an instance with the provided template, callback and delegate. When using stateful retry, the retry context key is a concatenated Stringtopic-partition-offset
. ADefaultErrorHandler
is required in the listener container because stateful retry will throw the exception to the container for each delivery attempt.- Parameters:
messageListener
- the delegate listener.retryTemplate
- the template.recoveryCallback
- the recovery callback; if null, the exception will be thrown to the container after retries are exhausted.stateful
- true for stateful retry.- Since:
- 2.1.3
-
-
Method Detail
-
onMessage
public void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record, @Nullable Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
Deprecated.Description copied from interface:GenericMessageListener
Invoked with data from kafka and provides access to theConsumer
. The default implementation throwsUnsupportedOperationException
.- Specified by:
onMessage
in interfaceAcknowledgingConsumerAwareMessageListener<K,V>
- Specified by:
onMessage
in interfaceGenericMessageListener<K>
- Parameters:
record
- the data to be processed.acknowledgment
- the acknowledgment.consumer
- the consumer.
-
onMessage
public void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data)
Deprecated.Description copied from interface:AcknowledgingConsumerAwareMessageListener
Invoked with data from kafka. Containers should never call this since it they will detect that we are a consumer aware acknowledging listener.- Specified by:
onMessage
in interfaceAcknowledgingConsumerAwareMessageListener<K,V>
- Specified by:
onMessage
in interfaceGenericMessageListener<K>
- Parameters:
data
- the data to be processed.
-
onMessage
public void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data, Acknowledgment acknowledgment)
Deprecated.Description copied from interface:GenericMessageListener
Invoked with data from kafka. The default implementation throwsUnsupportedOperationException
.- Specified by:
onMessage
in interfaceGenericMessageListener<K>
- Parameters:
data
- the data to be processed.acknowledgment
- the acknowledgment.
-
onMessage
public void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data, org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
Deprecated.Description copied from interface:GenericMessageListener
Invoked with data from kafka and provides access to theConsumer
. The default implementation throwsUnsupportedOperationException
.- Specified by:
onMessage
in interfaceGenericMessageListener<K>
- Parameters:
data
- the data to be processed.consumer
- the consumer.
-
-