public class SeekToCurrentErrorHandler extends FailedRecordProcessor implements ContainerAwareErrorHandler
logger| Constructor and Description |
|---|
SeekToCurrentErrorHandler()
Construct an instance with the default recoverer which simply logs the record after
(maxFailures) have occurred for a
topic/partition/offset.
|
SeekToCurrentErrorHandler(org.springframework.util.backoff.BackOff backOff)
Construct an instance with the default recoverer which simply logs the record after
the backOff returns STOP for a topic/partition/offset.
|
SeekToCurrentErrorHandler(java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> recoverer)
Construct an instance with the provided recoverer which will be called after
(maxFailures) have occurred for a
topic/partition/offset.
|
SeekToCurrentErrorHandler(java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> recoverer,
org.springframework.util.backoff.BackOff backOff)
Construct an instance with the provided recoverer which will be called after
the backOff returns STOP for a topic/partition/offset.
|
| Modifier and Type | Method and Description |
|---|---|
void |
handle(java.lang.Exception thrownException,
java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> records,
org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
MessageListenerContainer container)
Handle the exception.
|
boolean |
isAckAfterHandle()
Return true if the offset should be committed for a handled error (no exception
thrown).
|
void |
setAckAfterHandle(boolean ackAfterHandle)
Set to false to tell the container to NOT commit the offset for a recovered record.
|
void |
setCommitRecovered(boolean commitRecovered)
Set to true to commit the offset for a recovered record.
|
addNotRetryableException, clearThreadState, deliveryAttempt, getClassifier, getSkipPredicate, isCommitRecovered, removeNotRetryableException, setClassificationsgetLogLevel, setLogLevelclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlehandlehandleclearThreadStatepublic SeekToCurrentErrorHandler()
public SeekToCurrentErrorHandler(org.springframework.util.backoff.BackOff backOff)
backOff - the BackOff.public SeekToCurrentErrorHandler(java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> recoverer)
recoverer - the recoverer.public SeekToCurrentErrorHandler(@Nullable
java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> recoverer,
org.springframework.util.backoff.BackOff backOff)
recoverer - the recoverer; if null, the default (logging) recoverer is used.backOff - the BackOff.public void setCommitRecovered(boolean commitRecovered)
ContainerProperties.AckMode.MANUAL_IMMEDIATE. Whether or not
the commit is sync or async depends on the container's syncCommits
property.setCommitRecovered in class FailedRecordProcessorcommitRecovered - true to commit.public void handle(java.lang.Exception thrownException,
java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> records,
org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
MessageListenerContainer container)
ErrorHandlerhandle in interface ConsumerAwareErrorHandlerhandle in interface ContainerAwareErrorHandlerhandle in interface ErrorHandlerhandle in interface RemainingRecordsErrorHandlerthrownException - the exception.records - the remaining records including the one that failed.consumer - the consumer.container - the container.public boolean isAckAfterHandle()
GenericErrorHandlerisAckAfterHandle in interface GenericErrorHandler<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>>public void setAckAfterHandle(boolean ackAfterHandle)
ackAfterHandle - false to suppress committing the offset.