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
Subclass of
FailedRecordProcessor that can process (and recover) a batch. If
the listener throws a BatchListenerFailedException, 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
- Author:
- Gary Russell
-
Field Summary
Fields inherited from class org.springframework.kafka.listener.FailedRecordProcessor
logger -
Constructor Summary
ConstructorsConstructorDescriptionFailedBatchProcessor(BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?, ?>, Exception> recoverer, BackOff backOff, CommonErrorHandler fallbackHandler) Construct an instance with the provided properties. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoHandle(Exception thrownException, org.apache.kafka.clients.consumer.ConsumerRecords<?, ?> data, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, MessageListenerContainer container, Runnable invokeListener) Methods inherited from class org.springframework.kafka.listener.FailedRecordProcessor
clearThreadState, deliveryAttempt, getRecoveryStrategy, isCommitRecovered, setBackOffFunction, setCommitRecovered, setResetStateOnExceptionChange, setResetStateOnRecoveryFailure, setRetryListenersMethods inherited from class org.springframework.kafka.listener.ExceptionClassifier
addNotRetryableExceptions, getClassifier, removeNotRetryableException, setClassificationsMethods inherited from class org.springframework.kafka.listener.KafkaExceptionLogLevelAware
getLogLevel, setLogLevel
-
Constructor Details
-
FailedBatchProcessor
public FailedBatchProcessor(@Nullable BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?, ?>, Exception> recoverer, 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 Details
-
doHandle
protected void doHandle(Exception thrownException, org.apache.kafka.clients.consumer.ConsumerRecords<?, ?> data, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, MessageListenerContainer container, Runnable invokeListener)
-