Interface BatchMessageListener<K,V>

Type Parameters:
K - the key type.
V - the value type.
All Superinterfaces:
GenericMessageListener<List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>>
All Known Subinterfaces:
BatchAcknowledgingConsumerAwareMessageListener<K,V>, BatchAcknowledgingMessageListener<K,V>, BatchConsumerAwareMessageListener<K,V>
All Known Implementing Classes:
AggregatingReplyingKafkaTemplate, BatchMessagingMessageListenerAdapter, FilteringBatchMessageListenerAdapter, ReplyingKafkaTemplate
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 BatchMessageListener<K,V> extends GenericMessageListener<List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>>
Listener for handling a batch of incoming Kafka messages; the list is created from the consumer records object returned by a poll.
Since:
1.1
Author:
Marius Bogoevici, Gary Russell
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onMessage(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records, Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
    Listener receives the original ConsumerRecords object instead of a list of ConsumerRecord.
    default boolean
    Return true if this listener wishes to receive the original ConsumerRecords object instead of a list of ConsumerRecord.

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

    onMessage, onMessage, onMessage, onMessage
  • Method Details

    • onMessage

      default void onMessage(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records, @Nullable Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
      Listener receives the original ConsumerRecords object instead of a list of ConsumerRecord.
      Parameters:
      records - the records.
      acknowledgment - the acknowledgment (null if not manual acks)
      consumer - the consumer.
      Since:
      2.2
    • wantsPollResult

      default boolean wantsPollResult()
      Return true if this listener wishes to receive the original ConsumerRecords object instead of a list of ConsumerRecord.
      Returns:
      true for consumer records.
      Since:
      2.2