K - the key type.V - the value type.public class RetryingMessageListenerAdapter<K,V> extends AbstractRetryingMessageListenerAdapter<K,V,MessageListener<K,V>> implements AcknowledgingConsumerAwareMessageListener<K,V>
MessageListeners.ConsumerSeekAware.ConsumerSeekCallback| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONTEXT_ACKNOWLEDGMENT
RetryContext attribute key for an acknowledgment
if the listener is capable of acknowledging. |
static java.lang.String |
CONTEXT_CONSUMER
RetryContext attribute key for the consumer if
the listener is consumer-aware. |
static java.lang.String |
CONTEXT_RECORD
RetryContext attribute key for the record. |
delegate, delegateType, logger| Constructor and Description |
|---|
RetryingMessageListenerAdapter(MessageListener<K,V> messageListener,
org.springframework.retry.support.RetryTemplate retryTemplate)
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)
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)
Construct an instance with the provided template, callback and delegate.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data)
Invoked with data from kafka.
|
void |
onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data,
Acknowledgment acknowledgment)
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)
Invoked with data from kafka and provides access to the
Consumer
for operations such as pause/resume. |
void |
onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data,
org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
Invoked with data from kafka and provides access to the
Consumer
for operations such as pause/resume. |
getRecoveryCallback, getRetryTemplategetDelegate, onIdleContainer, onPartitionsAssigned, registerSeekCallbackpublic static final java.lang.String CONTEXT_ACKNOWLEDGMENT
RetryContext attribute key for an acknowledgment
if the listener is capable of acknowledging.public static final java.lang.String CONTEXT_CONSUMER
RetryContext attribute key for the consumer if
the listener is consumer-aware.public static final java.lang.String CONTEXT_RECORD
RetryContext attribute key for the record.public RetryingMessageListenerAdapter(MessageListener<K,V> messageListener, org.springframework.retry.support.RetryTemplate retryTemplate)
messageListener - the delegate listener.retryTemplate - the template.public RetryingMessageListenerAdapter(MessageListener<K,V> messageListener, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback)
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.public RetryingMessageListenerAdapter(MessageListener<K,V> messageListener, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback, boolean stateful)
topic-partition-offset. A
SeekToCurrentErrorHandler is required in
the listener container because stateful retry will throw the exception to the
container for each delivery attempt.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.public void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record, Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
GenericMessageListenerConsumer
for operations such as pause/resume. Invoked with null data when a poll
returns no data (enabling resume). The default implementation throws
UnsupportedOperationException.onMessage in interface AcknowledgingConsumerAwareMessageListener<K,V>onMessage in interface GenericMessageListener<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>record - the data to be processed.acknowledgment - the acknowledgment.consumer - the consumer.public void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data)
AcknowledgingConsumerAwareMessageListeneronMessage in interface AcknowledgingConsumerAwareMessageListener<K,V>onMessage in interface GenericMessageListener<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>data - the data to be processed.public void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data, Acknowledgment acknowledgment)
GenericMessageListenerUnsupportedOperationException.onMessage in interface GenericMessageListener<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>data - the data to be processed.acknowledgment - the acknowledgment.public void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data, org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
GenericMessageListenerConsumer
for operations such as pause/resume. Invoked with null data when a poll
returns no data (enabling resume). The default implementation throws
UnsupportedOperationException.onMessage in interface GenericMessageListener<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>data - the data to be processed.consumer - the consumer.