Class DefaultAfterRollbackProcessor<K,V>

Type Parameters:
K - the key type.
V - the value type.
All Implemented Interfaces:
AfterRollbackProcessor<K,V>, DeliveryAttemptAware

public class DefaultAfterRollbackProcessor<K,V> extends FailedRecordProcessor implements AfterRollbackProcessor<K,V>
Default implementation of AfterRollbackProcessor. Seeks all topic/partitions so the records will be re-fetched, including the failed record. Starting with version 2.2 after a configurable number of failures for the same topic/partition/offset, that record will be skipped after calling a BiConsumer recoverer. The default recoverer simply logs the failed record.
Since:
1.3.5
Author:
Gary Russell, Francois Rosiere
  • Constructor Details

    • DefaultAfterRollbackProcessor

      public DefaultAfterRollbackProcessor()
      Construct an instance with the default recoverer which simply logs the record after 10 (maxFailures) have occurred for a topic/partition/offset.
      Since:
      2.2
    • DefaultAfterRollbackProcessor

      public DefaultAfterRollbackProcessor(BackOff backOff)
      Construct an instance with the default recoverer which simply logs the record after the backOff returns STOP for a topic/partition/offset.
      Parameters:
      backOff - the BackOff.
      Since:
      2.3
    • DefaultAfterRollbackProcessor

      public DefaultAfterRollbackProcessor(BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,Exception> recoverer)
      Construct an instance with the provided recoverer which will be called after 10 (maxFailures) have occurred for a topic/partition/offset.
      Parameters:
      recoverer - the recoverer.
      Since:
      2.2
    • DefaultAfterRollbackProcessor

      public DefaultAfterRollbackProcessor(@Nullable BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,Exception> recoverer, BackOff backOff)
      Construct an instance with the provided recoverer which will be called after the backOff returns STOP for a topic/partition/offset.
      Parameters:
      recoverer - the recoverer; if null, the default (logging) recoverer is used.
      backOff - the BackOff.
      Since:
      2.3
    • DefaultAfterRollbackProcessor

      public DefaultAfterRollbackProcessor(@Nullable BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,Exception> recoverer, BackOff backOff, @Nullable KafkaOperations<?,?> kafkaOperations, boolean commitRecovered)
      Construct an instance with the provided recoverer which will be called after the backOff returns STOP for a topic/partition/offset.
      Parameters:
      recoverer - the recoverer; if null, the default (logging) recoverer is used.
      backOff - the BackOff.
      kafkaOperations - for sending the recovered offset to the transaction.
      commitRecovered - true to commit the recovered record's offset; requires a KafkaOperations.
      Since:
      2.5.3
    • DefaultAfterRollbackProcessor

      public DefaultAfterRollbackProcessor(@Nullable BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,Exception> recoverer, BackOff backOff, @Nullable BackOffHandler backOffHandler, @Nullable KafkaOperations<?,?> kafkaOperations, boolean commitRecovered)
      Construct an instance with the provided recoverer which will be called after the backOff returns STOP for a topic/partition/offset.
      Parameters:
      recoverer - the recoverer; if null, the default (logging) recoverer is used.
      backOff - the BackOff.
      backOffHandler - the BackOffHandler.
      kafkaOperations - for sending the recovered offset to the transaction.
      commitRecovered - true to commit the recovered record's offset; requires a KafkaOperations.
      Since:
      2.9
  • Method Details