Class KafkaBackoffAwareMessageListenerAdapter<K,V>

java.lang.Object
org.springframework.kafka.listener.adapter.AbstractDelegatingMessageListenerAdapter<MessageListener<K,V>>
org.springframework.kafka.listener.adapter.KafkaBackoffAwareMessageListenerAdapter<K,V>
Type Parameters:
K - the record key type.
V - the record 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>

public class KafkaBackoffAwareMessageListenerAdapter<K,V> extends AbstractDelegatingMessageListenerAdapter<MessageListener<K,V>> implements AcknowledgingConsumerAwareMessageListener<K,V>
A AcknowledgingConsumerAwareMessageListener implementation that looks for a backoff dueTimestamp header and invokes a KafkaConsumerBackoffManager instance that will back off if necessary.
Since:
2.7
  • Constructor Details

    • KafkaBackoffAwareMessageListenerAdapter

      public KafkaBackoffAwareMessageListenerAdapter(MessageListener<K,V> delegate, KafkaConsumerBackoffManager kafkaConsumerBackoffManager, String listenerId, String backoffTimestampHeader, Clock clock)
      The configuration for this listener adapter.
      Parameters:
      delegate - the MessageListener instance that will handle the messages.
      kafkaConsumerBackoffManager - the manager that will handle the back off.
      listenerId - the id of the listener container associated to this adapter.
      backoffTimestampHeader - the header name that will be looked up in the incoming record to acquire the timestamp.
      clock - the clock instance that will be used to timestamp the exception throwing.
      Since:
      2.7
    • KafkaBackoffAwareMessageListenerAdapter

      public KafkaBackoffAwareMessageListenerAdapter(MessageListener<K,V> adapter, KafkaConsumerBackoffManager kafkaConsumerBackoffManager, String listenerId, Clock clock) throws KafkaBackoffException
      Throws:
      KafkaBackoffException
  • Method Details