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 for
MessageListener
s.- Author:
- Gary Russell
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.kafka.listener.ConsumerSeekAware
ConsumerSeekAware.ConsumerSeekCallback
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Deprecated.RetryContext
attribute key for an acknowledgment if the listener is capable of acknowledging.static final String
Deprecated.RetryContext
attribute key for the consumer if the listener is consumer-aware.static final String
Deprecated.RetryContext
attribute key for the record.Fields inherited from class org.springframework.kafka.listener.adapter.AbstractDelegatingMessageListenerAdapter
delegate, delegateType, logger
-
Constructor Summary
ConstructorsConstructorDescriptionRetryingMessageListenerAdapter
(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 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 Object> recoveryCallback, boolean stateful) Deprecated.Construct an instance with the provided template, callback and delegate. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 Details
-
CONTEXT_ACKNOWLEDGMENT
Deprecated.RetryContext
attribute key for an acknowledgment if the listener is capable of acknowledging.- See Also:
-
CONTEXT_CONSUMER
Deprecated.RetryContext
attribute key for the consumer if the listener is consumer-aware.- See Also:
-
CONTEXT_RECORD
Deprecated.RetryContext
attribute key for the record.- See Also:
-
-
Constructor Details
-
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 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 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 Details
-
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
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.
-