Class CompositeBatchInterceptor<K,​V>

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

    public class CompositeBatchInterceptor<K,​V>
    extends java.lang.Object
    implements BatchInterceptor<K,​V>
    A BatchInterceptor that delegates to one or more BatchInterceptors in order.
    Since:
    2.6.8
    Author:
    Gary Russell
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void failure​(org.apache.kafka.clients.consumer.ConsumerRecords<K,​V> records, java.lang.Exception exception)
      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)
      Perform some action on the records or return a different one.
      void success​(org.apache.kafka.clients.consumer.ConsumerRecords<K,​V> records)
      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

      • CompositeBatchInterceptor

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

      • intercept

        public org.apache.kafka.clients.consumer.ConsumerRecords<K,​V> intercept​(org.apache.kafka.clients.consumer.ConsumerRecords<K,​V> records)
        Description copied from interface: BatchInterceptor
        Perform some action on the records or return a different one. If null is returned the records will be skipped. Invoked before the listener.
        Specified by:
        intercept in interface BatchInterceptor<K,​V>
        Parameters:
        records - the records.
        Returns:
        the records or null.
      • success

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

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