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>
A RecordInterceptor that has access to the Consumer.
Since:
2.7
  • Method Summary

    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 Details

    • 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.
      Specified by:
      intercept in interface RecordInterceptor<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 interface RecordInterceptor<K,V>
      Parameters:
      record - the record.
      consumer - the consumer.
      Returns:
      the record or null.