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 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 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.