Class FailedBatchProcessor
- java.lang.Object
-
- org.springframework.kafka.listener.KafkaExceptionLogLevelAware
-
- org.springframework.kafka.listener.ExceptionClassifier
-
- org.springframework.kafka.listener.FailedRecordProcessor
-
- org.springframework.kafka.listener.FailedBatchProcessor
-
- All Implemented Interfaces:
DeliveryAttemptAware
- Direct Known Subclasses:
DefaultErrorHandler
,RecoveringBatchErrorHandler
public abstract class FailedBatchProcessor extends FailedRecordProcessor
Subclass ofFailedRecordProcessor
that can process (and recover) a batch. If the listener throws aBatchListenerFailedException
, the offsets prior to the failed record are committed and the remaining records have seeks performed. When the retries are exhausted, the failed record is sent to the recoverer instead of being included in the seeks. If other exceptions are thrown processing is delegated to the fallback handler.- Since:
- 2.8
-
-
Field Summary
-
Fields inherited from class org.springframework.kafka.listener.FailedRecordProcessor
logger
-
-
Constructor Summary
Constructors Constructor Description FailedBatchProcessor(java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> recoverer, org.springframework.util.backoff.BackOff backOff, CommonErrorHandler fallbackHandler)
Construct an instance with the provided properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doHandle(java.lang.Exception thrownException, org.apache.kafka.clients.consumer.ConsumerRecords<?,?> data, org.apache.kafka.clients.consumer.Consumer<?,?> consumer, MessageListenerContainer container, java.lang.Runnable invokeListener)
-
Methods inherited from class org.springframework.kafka.listener.FailedRecordProcessor
clearThreadState, deliveryAttempt, getRecoveryStrategy, getSkipPredicate, isCommitRecovered, setBackOffFunction, setCommitRecovered, setResetStateOnExceptionChange, setResetStateOnRecoveryFailure, setRetryListeners
-
Methods inherited from class org.springframework.kafka.listener.ExceptionClassifier
addNotRetryableExceptions, getClassifier, removeNotRetryableException, setClassifications
-
Methods inherited from class org.springframework.kafka.listener.KafkaExceptionLogLevelAware
getLogLevel, setLogLevel
-
-
-
-
Constructor Detail
-
FailedBatchProcessor
public FailedBatchProcessor(@Nullable java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> recoverer, org.springframework.util.backoff.BackOff backOff, CommonErrorHandler fallbackHandler)
Construct an instance with the provided properties.- Parameters:
recoverer
- the recoverer.backOff
- the back off.fallbackHandler
- the fall back handler.
-
-
Method Detail
-
doHandle
protected void doHandle(java.lang.Exception thrownException, org.apache.kafka.clients.consumer.ConsumerRecords<?,?> data, org.apache.kafka.clients.consumer.Consumer<?,?> consumer, MessageListenerContainer container, java.lang.Runnable invokeListener)
-
-