K - the key type.V - the value type.public class DefaultAfterRollbackProcessor<K,V> extends java.lang.Object implements AfterRollbackProcessor<K,V>
AfterRollbackProcessor. Seeks all
topic/partitions so the records will be re-fetched, including the failed
record. Starting with version 2.2 after a configurable number of failures
for the same topic/partition/offset, that record will be skipped after
calling a BiConsumer recoverer. The default recoverer simply logs
the failed record.| Constructor and Description |
|---|
DefaultAfterRollbackProcessor()
Construct an instance with the default recoverer which simply logs the record after
(maxFailures) have occurred for a
topic/partition/offset.
|
DefaultAfterRollbackProcessor(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.
|
DefaultAfterRollbackProcessor(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.
|
DefaultAfterRollbackProcessor(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 |
process(java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> records,
org.apache.kafka.clients.consumer.Consumer<K,V> consumer,
java.lang.Exception exception,
boolean recoverable)
Process the remaining records.
|
public DefaultAfterRollbackProcessor()
public DefaultAfterRollbackProcessor(int maxFailures)
maxFailures - the maxFailures; a negative value is treated as infinity.public DefaultAfterRollbackProcessor(java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> recoverer)
recoverer - the recoverer.public DefaultAfterRollbackProcessor(@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.public void process(java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> records, org.apache.kafka.clients.consumer.Consumer<K,V> consumer, java.lang.Exception exception, boolean recoverable)
AfterRollbackProcessorprocess in interface AfterRollbackProcessor<K,V>records - the records.consumer - the consumer.exception - the exceptionrecoverable - the recoverable.public void clearThreadState()
AfterRollbackProcessorclearThreadState in interface AfterRollbackProcessor<K,V>