Interface BatchMessageListener<K,V>
-
- Type Parameters:
K- the key type.V- the value type.
- All Superinterfaces:
GenericMessageListener<java.util.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<java.util.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
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidonMessage(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records, Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)Listener receives the originalConsumerRecordsobject instead of a list ofConsumerRecord.default booleanwantsPollResult()Return true if this listener wishes to receive the originalConsumerRecordsobject instead of a list ofConsumerRecord.-
Methods inherited from interface org.springframework.kafka.listener.GenericMessageListener
onMessage, onMessage, onMessage, onMessage
-
-
-
-
Method Detail
-
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 originalConsumerRecordsobject instead of a list ofConsumerRecord.- 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 originalConsumerRecordsobject instead of a list ofConsumerRecord.- Returns:
- true for consumer records.
- Since:
- 2.2
-
-