Class SeekToCurrentErrorHandler
java.lang.Object
org.springframework.kafka.listener.KafkaExceptionLogLevelAware
org.springframework.kafka.listener.ExceptionClassifier
org.springframework.kafka.listener.FailedRecordProcessor
org.springframework.kafka.listener.SeekToCurrentErrorHandler
- All Implemented Interfaces:
ConsumerAwareErrorHandler,ContainerAwareErrorHandler,DeliveryAttemptAware,ErrorHandler,GenericErrorHandler<org.apache.kafka.clients.consumer.ConsumerRecord<?,,?>> RemainingRecordsErrorHandler
@Deprecated
public class SeekToCurrentErrorHandler
extends FailedRecordProcessor
implements ContainerAwareErrorHandler
Deprecated.
An error handler that seeks to the current offset for each topic in the remaining
records. Used to rewind partitions after a message failure so that it can be
replayed.
- Since:
- 2.0.1
-
Field Summary
Fields inherited from class org.springframework.kafka.listener.FailedRecordProcessor
logger -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Construct an instance with the default recoverer which simply logs the record after 10 (maxFailures) have occurred for a topic/partition/offset, with the default back off (9 retries, no delay).SeekToCurrentErrorHandler(BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?, ?>, Exception> recoverer) Deprecated.Construct an instance with the provided recoverer which will be called after 10 (maxFailures) have occurred for a topic/partition/offset.SeekToCurrentErrorHandler(BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?, ?>, Exception> recoverer, org.springframework.util.backoff.BackOff backOff) Deprecated.Construct an instance with the provided recoverer which will be called after the backOff returns STOP for a topic/partition/offset.SeekToCurrentErrorHandler(org.springframework.util.backoff.BackOff backOff) Deprecated.Construct an instance with the default recoverer which simply logs the record after the backOff returns STOP for a topic/partition/offset. -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(Exception thrownException, List<org.apache.kafka.clients.consumer.ConsumerRecord<?, ?>> records, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, MessageListenerContainer container) Deprecated.Handle the exception.booleanDeprecated.Return true if the offset should be committed for a handled error (no exception thrown).voidsetAckAfterHandle(boolean ackAfterHandle) Deprecated.Set to false to prevent the container from committing the offset of a recovered record (when the error handler does not itself throw an exception).voidsetCommitRecovered(boolean commitRecovered) Deprecated.Set to true to commit the offset for a recovered record.Methods inherited from class org.springframework.kafka.listener.FailedRecordProcessor
clearThreadState, deliveryAttempt, getRecoveryStrategy, getRecoveryStrategy, getSkipPredicate, isCommitRecovered, setBackOffFunction, setResetStateOnExceptionChange, setResetStateOnRecoveryFailure, setRetryListenersMethods inherited from class org.springframework.kafka.listener.ExceptionClassifier
addNotRetryableExceptions, addRetryableExceptions, defaultFalse, getClassifier, removeClassification, removeNotRetryableException, setClassificationsMethods inherited from class org.springframework.kafka.listener.KafkaExceptionLogLevelAware
getLogLevel, setLogLevelMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.kafka.listener.ConsumerAwareErrorHandler
handleMethods inherited from interface org.springframework.kafka.listener.ContainerAwareErrorHandler
handleMethods inherited from interface org.springframework.kafka.listener.GenericErrorHandler
clearThreadStateMethods inherited from interface org.springframework.kafka.listener.RemainingRecordsErrorHandler
handle
-
Constructor Details
-
SeekToCurrentErrorHandler
public SeekToCurrentErrorHandler()Deprecated.Construct an instance with the default recoverer which simply logs the record after 10 (maxFailures) have occurred for a topic/partition/offset, with the default back off (9 retries, no delay).- Since:
- 2.2
-
SeekToCurrentErrorHandler
public SeekToCurrentErrorHandler(org.springframework.util.backoff.BackOff backOff) Deprecated.Construct an instance with the default recoverer which simply logs the record after the backOff returns STOP for a topic/partition/offset.- Parameters:
backOff- theBackOff.- Since:
- 2.3
-
SeekToCurrentErrorHandler
public SeekToCurrentErrorHandler(BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?, ?>, Exception> recoverer) Deprecated.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
-
SeekToCurrentErrorHandler
public SeekToCurrentErrorHandler(@Nullable BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?, ?>, Exception> recoverer, org.springframework.util.backoff.BackOff backOff) Deprecated.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- theBackOff.- Since:
- 2.3
-
-
Method Details
-
setCommitRecovered
public void setCommitRecovered(boolean commitRecovered) Deprecated.Set to true to commit the offset for a recovered record. The container must be configured withContainerProperties.AckMode.MANUAL_IMMEDIATE. Whether or not the commit is sync or async depends on the container's syncCommits property.- Overrides:
setCommitRecoveredin classFailedRecordProcessor- Parameters:
commitRecovered- true to commit.
-
isAckAfterHandle
public boolean isAckAfterHandle()Deprecated.Description copied from interface:GenericErrorHandlerReturn true if the offset should be committed for a handled error (no exception thrown).- Specified by:
isAckAfterHandlein interfaceGenericErrorHandler<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> - Returns:
- true to commit.
-
setAckAfterHandle
public void setAckAfterHandle(boolean ackAfterHandle) Deprecated.Description copied from interface:GenericErrorHandlerSet to false to prevent the container from committing the offset of a recovered record (when the error handler does not itself throw an exception).- Specified by:
setAckAfterHandlein interfaceGenericErrorHandler<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> - Parameters:
ackAfterHandle- false to not commit.
-
handle
public void handle(Exception thrownException, @Nullable List<org.apache.kafka.clients.consumer.ConsumerRecord<?, ?>> records, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, MessageListenerContainer container) Deprecated.Description copied from interface:ErrorHandlerHandle the exception.- Specified by:
handlein interfaceConsumerAwareErrorHandler- Specified by:
handlein interfaceContainerAwareErrorHandler- Specified by:
handlein interfaceErrorHandler- Specified by:
handlein interfaceRemainingRecordsErrorHandler- Parameters:
thrownException- the exception.records- the remaining records including the one that failed.consumer- the consumer.container- the container.
-
DefaultErrorHandler.