Interface AcknowledgingMessageListener<K,​V>

  • Type Parameters:
    K - the key type.
    V - the value type.
    All Superinterfaces:
    GenericMessageListener<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>, MessageListener<K,​V>
    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 AcknowledgingMessageListener<K,​V>
    extends MessageListener<K,​V>
    Listener for handling incoming Kafka messages, propagating an acknowledgment handle that recipients can invoke when the message has been processed.
    Author:
    Marius Bogoevici, Gary Russell
    • Method Detail

      • onMessage

        default void onMessage​(org.apache.kafka.clients.consumer.ConsumerRecord<K,​V> data)
        Invoked with data from kafka. Containers should never call this since it they will detect that we are an acknowledging listener.
        Specified by:
        onMessage in interface GenericMessageListener<K>
        Parameters:
        data - the data to be processed.
      • onMessage

        void onMessage​(org.apache.kafka.clients.consumer.ConsumerRecord<K,​V> data,
                       Acknowledgment acknowledgment)
        Invoked with data from kafka.
        Specified by:
        onMessage in interface GenericMessageListener<K>
        Parameters:
        data - the data to be processed.
        acknowledgment - the acknowledgment.