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
MessageListeners.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.kafka.listener.ConsumerSeekAware
ConsumerSeekAware.ConsumerSeekCallback -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.RetryContextattribute key for an acknowledgment if the listener is capable of acknowledging.static final StringDeprecated.RetryContextattribute key for the consumer if the listener is consumer-aware.static final StringDeprecated.RetryContextattribute 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 TypeMethodDescriptionvoidDeprecated.Invoked with data from kafka.voidonMessage(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.voidonMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K, V> data, Acknowledgment acknowledgment) Deprecated.Invoked with data from kafka.voidonMessage(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, getRetryTemplateMethods inherited from class org.springframework.kafka.listener.adapter.AbstractDelegatingMessageListenerAdapter
getDelegate, onIdleContainer, onPartitionsAssigned, onPartitionsRevoked, registerSeekCallbackMethods 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
unregisterSeekCallback
-
Field Details
-
CONTEXT_ACKNOWLEDGMENT
Deprecated.RetryContextattribute key for an acknowledgment if the listener is capable of acknowledging.- See Also:
-
CONTEXT_CONSUMER
Deprecated.RetryContextattribute key for the consumer if the listener is consumer-aware.- See Also:
-
CONTEXT_RECORD
Deprecated.RetryContextattribute 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. ASeekToCurrentErrorHandleris 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:GenericMessageListenerInvoked with data from kafka and provides access to theConsumer. The default implementation throwsUnsupportedOperationException.- Specified by:
onMessagein interfaceAcknowledgingConsumerAwareMessageListener<K,V> - Specified by:
onMessagein interfaceGenericMessageListener<K>- Parameters:
record- the data to be processed.acknowledgment- the acknowledgment.consumer- the consumer.
-
onMessage
Deprecated.Description copied from interface:AcknowledgingConsumerAwareMessageListenerInvoked with data from kafka. Containers should never call this since it they will detect that we are a consumer aware acknowledging listener.- Specified by:
onMessagein interfaceAcknowledgingConsumerAwareMessageListener<K,V> - Specified by:
onMessagein 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:GenericMessageListenerInvoked with data from kafka. The default implementation throwsUnsupportedOperationException.- Specified by:
onMessagein 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:GenericMessageListenerInvoked with data from kafka and provides access to theConsumer. The default implementation throwsUnsupportedOperationException.- Specified by:
onMessagein interfaceGenericMessageListener<K>- Parameters:
data- the data to be processed.consumer- the consumer.
-