Interface ConsumerAwareRecordInterceptor<K,V>
-
- Type Parameters:
K
- the key type.V
- the value type.
- All Superinterfaces:
RecordInterceptor<K,V>
,ThreadStateProcessor
- All Known Implementing Classes:
CompositeRecordInterceptor
- 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 ConsumerAwareRecordInterceptor<K,V> extends RecordInterceptor<K,V>
ARecordInterceptor
that has access to theConsumer
.- Since:
- 2.7
- Author:
- Gary Russell
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default org.apache.kafka.clients.consumer.ConsumerRecord<K,V>
intercept(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
Perform some action on the record or return a different one.org.apache.kafka.clients.consumer.ConsumerRecord<K,V>
intercept(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Perform some action on the record or return a different one.-
Methods inherited from interface org.springframework.kafka.listener.RecordInterceptor
afterRecord, failure, success
-
Methods inherited from interface org.springframework.kafka.listener.ThreadStateProcessor
clearThreadState, setupThreadState
-
-
-
-
Method Detail
-
intercept
@Nullable default org.apache.kafka.clients.consumer.ConsumerRecord<K,V> intercept(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
Description copied from interface:RecordInterceptor
Perform some action on the record or return a different one. If null is returned the record will be skipped. Invoked before the listener. IMPORTANT; if this method returns a different record, the topic, partition and offset must not be changed to avoid undesirable side-effects.- Specified by:
intercept
in interfaceRecordInterceptor<K,V>
- Parameters:
record
- the record.- Returns:
- the record or null.
-
intercept
@Nullable org.apache.kafka.clients.consumer.ConsumerRecord<K,V> intercept(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Description copied from interface:RecordInterceptor
Perform some action on the record or return a different one. If null is returned the record will be skipped. Invoked before the listener.- Specified by:
intercept
in interfaceRecordInterceptor<K,V>
- Parameters:
record
- the record.consumer
- the consumer.- Returns:
- the record or null.
-
-