Class CompositeRecordInterceptor<K,​V>

  • Type Parameters:
    K - the key type.
    V - the value type.
    All Implemented Interfaces:
    RecordInterceptor<K,​V>

    public class CompositeRecordInterceptor<K,​V>
    extends java.lang.Object
    implements RecordInterceptor<K,​V>
    A RecordInterceptor that delegates to one or more RecordInterceptors in order.
    Since:
    2.3
    Author:
    Artem Bilan, Gary Russell
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void failure​(org.apache.kafka.clients.consumer.ConsumerRecord<K,​V> record, java.lang.Exception exception)
      Called after the listener throws an exception.
      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.
      void success​(org.apache.kafka.clients.consumer.ConsumerRecord<K,​V> record)
      Called after the listener exits normally.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CompositeRecordInterceptor

        @SafeVarargs
        public CompositeRecordInterceptor​(RecordInterceptor<K,​V>... delegates)
        Construct an instance with the provided delegates.
        Parameters:
        delegates - the delegates.
    • Method Detail

      • intercept

        public 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.
      • success

        public void success​(org.apache.kafka.clients.consumer.ConsumerRecord<K,​V> record)
        Description copied from interface: RecordInterceptor
        Called after the listener exits normally.
        Specified by:
        success in interface RecordInterceptor<K,​V>
        Parameters:
        record - the record.
      • failure

        public void failure​(org.apache.kafka.clients.consumer.ConsumerRecord<K,​V> record,
                            java.lang.Exception exception)
        Description copied from interface: RecordInterceptor
        Called after the listener throws an exception.
        Specified by:
        failure in interface RecordInterceptor<K,​V>
        Parameters:
        record - the record.
        exception - the exception.