Interface BatchInterceptor<K,V>
-
- Type Parameters:
K
- the key type.V
- the value type.
- All Superinterfaces:
ThreadStateProcessor
- All Known Implementing Classes:
CompositeBatchInterceptor
- 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 BatchInterceptor<K,V> extends ThreadStateProcessor
An interceptor for batches of records.- Since:
- 2.7
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
failure(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records, java.lang.Exception exception, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Called after the listener throws an exception.org.apache.kafka.clients.consumer.ConsumerRecords<K,V>
intercept(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Perform some action on the records or return a different one.default void
success(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Called after the listener exits normally.-
Methods inherited from interface org.springframework.kafka.listener.ThreadStateProcessor
clearThreadState, setupThreadState
-
-
-
-
Method Detail
-
intercept
@Nullable org.apache.kafka.clients.consumer.ConsumerRecords<K,V> intercept(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Perform some action on the records or return a different one. If null is returned the records will be skipped. Invoked before the listener.- Parameters:
records
- the records.consumer
- the consumer.- Returns:
- the records or null.
-
success
default void success(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Called after the listener exits normally.- Parameters:
records
- the records.consumer
- the consumer.
-
failure
default void failure(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records, java.lang.Exception exception, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Called after the listener throws an exception.- Parameters:
records
- the records.exception
- the exception.consumer
- the consumer.
-
-