Interface AfterRollbackProcessor<K,V>
-
- Type Parameters:
K
- the key type.V
- the value type.
- All Known Implementing Classes:
DefaultAfterRollbackProcessor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface AfterRollbackProcessor<K,V>
Invoked by a listener container with remaining, unprocessed, records (including the failed record). Implementations should seek the desired topics/partitions so that records will be re-fetched on the next poll. When used with a batch listener, the entire batch of records is provided.- Since:
- 1.3.5
- Author:
- Gary Russell
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default void
clearThreadState()
Optional method to clear thread state; will be called just before a consumer thread terminates.default boolean
isProcessInTransaction()
Return true to invokeprocess(List, Consumer, MessageListenerContainer, Exception, boolean, ContainerProperties.EOSMode)
in a new transaction.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)
Deprecated.default 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, ContainerProperties.EOSMode eosMode)
Deprecated.default void
process(java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> records, org.apache.kafka.clients.consumer.Consumer<K,V> consumer, MessageListenerContainer container, java.lang.Exception exception, boolean recoverable, ContainerProperties.EOSMode eosMode)
Process the remaining records.
-
-
-
Method Detail
-
process
@Deprecated 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)
Deprecated.Process the remaining records. Recoverable will be true if the container is processing individual records; this allows the processor to recover (skip) the failed record rather than re-seeking it. This is not possible with a batch listener since only the listener itself knows which record in the batch keeps failing. IMPORTANT: If invoked in a transaction when the listener was invoked with a single record, the transaction id will be based on the container group.id and the topic/partition of the failed record, to avoid issues with zombie fencing. So, generally, only its offset should be sent to the transaction. For other behavior the process method should manage its own transaction.- Parameters:
records
- the records.consumer
- the consumer.exception
- the exceptionrecoverable
- the recoverable.- Since:
- 2.2
- See Also:
isProcessInTransaction()
-
process
@Deprecated default 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, ContainerProperties.EOSMode eosMode)
Deprecated.Process the remaining records. Recoverable will be true if the container is processing individual records; this allows the processor to recover (skip) the failed record rather than re-seeking it. This is not possible with a batch listener since only the listener itself knows which record in the batch keeps failing. IMPORTANT: If invoked in a transaction when the listener was invoked with a single record, the transaction id will be based on the container group.id and the topic/partition of the failed record, to avoid issues with zombie fencing (unless theContainerProperties.EOSMode
isContainerProperties.EOSMode.BETA
). So, generally, only its offset should be sent to the transaction. For other behavior the process method should manage its own transaction.- Parameters:
records
- the records.consumer
- the consumer.exception
- the exceptionrecoverable
- the recoverable.eosMode
- theContainerProperties.EOSMode
.- Since:
- 2.5.3
- See Also:
isProcessInTransaction()
-
process
default void process(java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> records, org.apache.kafka.clients.consumer.Consumer<K,V> consumer, @Nullable MessageListenerContainer container, java.lang.Exception exception, boolean recoverable, ContainerProperties.EOSMode eosMode)
Process the remaining records. Recoverable will be true if the container is processing individual records; this allows the processor to recover (skip) the failed record rather than re-seeking it. This is not possible with a batch listener since only the listener itself knows which record in the batch keeps failing. IMPORTANT: If invoked in a transaction when the listener was invoked with a single record, the transaction id will be based on the container group.id and the topic/partition of the failed record, to avoid issues with zombie fencing. So, generally, only its offset should be sent to the transaction. For other behavior the process method should manage its own transaction.- Parameters:
records
- the records.consumer
- the consumer.container
- the container or parent container.exception
- the exceptionrecoverable
- the recoverable.eosMode
- theContainerProperties.EOSMode
.- Since:
- 2.6.6
- See Also:
isProcessInTransaction()
-
clearThreadState
default void clearThreadState()
Optional method to clear thread state; will be called just before a consumer thread terminates.- Since:
- 2.2
-
isProcessInTransaction
default boolean isProcessInTransaction()
Return true to invokeprocess(List, Consumer, MessageListenerContainer, Exception, boolean, ContainerProperties.EOSMode)
in a new transaction. Because the container cannot infer the desired behavior, the processor is responsible for sending the offset to the transaction if it decides to skip the failing record.- Returns:
- true to run in a transaction; default false.
- Since:
- 2.2.5
- See Also:
process(List, Consumer, MessageListenerContainer, Exception, boolean, ContainerProperties.EOSMode)
-
-