Interface BatchAcknowledgingConsumerAwareMessageListener<K,V>

Type Parameters:
K - the key type.
V - the value type.
All Superinterfaces:
BatchMessageListener<K,V>, GenericMessageListener<List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>>
All Known Implementing Classes:
BatchMessagingMessageListenerAdapter, FilteringBatchMessageListenerAdapter
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 BatchAcknowledgingConsumerAwareMessageListener<K,V> extends BatchMessageListener<K,V>
Listener for handling a batch of incoming Kafka messages, propagating an acknowledgment handle that recipients can invoke when the message has been processed. The list is created from the consumer records object returned by a poll. Access to the Consumer is provided.
Since:
2.0
Author:
Gary Russell
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onMessage(List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> data)
    Invoked with data from kafka.
    void
    onMessage(List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> data, Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
    Invoked with data from kafka and provides access to the Consumer.

    Methods inherited from interface org.springframework.kafka.listener.BatchMessageListener

    onMessage, wantsPollResult

    Methods inherited from interface org.springframework.kafka.listener.GenericMessageListener

    onMessage, onMessage
  • Method Details

    • onMessage

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

      void onMessage(List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> data, @Nullable Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
      Description copied from interface: GenericMessageListener
      Invoked with data from kafka and provides access to the Consumer. The default implementation throws UnsupportedOperationException.
      Specified by:
      onMessage in interface GenericMessageListener<K>
      Parameters:
      data - the data to be processed.
      acknowledgment - the acknowledgment.
      consumer - the consumer.