public class SeekToCurrentErrorHandler extends java.lang.Object implements ContainerAwareErrorHandler
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
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(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,
int maxFailures)
Construct an instance with the provided recoverer which will be called after
maxFailures have occurred for a topic/partition/offset.
|
SeekToCurrentErrorHandler(int maxFailures)
Construct an instance with the default recoverer which simply logs the record after
'maxFailures' have occurred for a topic/partition/offset.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearThreadState()
Optional method to clear thread state; will be called just before a consumer
thread terminates.
|
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.
|
protected boolean |
isCommitRecovered()
Whether the offset for a recovered record should be committed.
|
void |
setCommitRecovered(boolean commitRecovered)
Set to true to commit the offset for a recovered record.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlehandlehandlepublic SeekToCurrentErrorHandler()
public SeekToCurrentErrorHandler(int maxFailures)
maxFailures - the maxFailures; a negative value is treated as infinity.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,
int maxFailures)
recoverer - the recoverer; if null, the default (logging) recoverer is used.maxFailures - the maxFailures; a negative value is treated as infinity.protected boolean isCommitRecovered()
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.commitRecovered - 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 void clearThreadState()
ErrorHandlerclearThreadState in interface ErrorHandler