Interface BatchInterceptor<K,​V>

  • Type Parameters:
    K - the key type.
    V - the value type.
    All Known Implementing Classes:
    CompositeBatchInterceptor
    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 BatchInterceptor<K,​V>
    An interceptor for batches of records.
    Since:
    2.6.8
    Author:
    Gary Russell
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default 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.
      default void success​(org.apache.kafka.clients.consumer.ConsumerRecords<K,​V> records)
      Called after the listener exits normally.
    • Method Detail

      • intercept

        @Nullable
        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. If null is returned the records will be skipped. Invoked before the listener.
        Parameters:
        records - the records.
        Returns:
        the records or null.
      • success

        default void success​(org.apache.kafka.clients.consumer.ConsumerRecords<K,​V> records)
        Called after the listener exits normally.
        Parameters:
        records - the records.
      • failure

        default void failure​(org.apache.kafka.clients.consumer.ConsumerRecords<K,​V> records,
                             java.lang.Exception exception)
        Called after the listener throws an exception.
        Parameters:
        records - the records.
        exception - the exception.