Interface BatchToRecordAdapter<K,V>
- Type Parameters:
K
- the key type.V
- the value type.
- All Known Implementing Classes:
DefaultBatchToRecordAdapter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An adapter that adapts a batch listener to a record listener method. Use this, for
example, if you want a batch to be processed in a single transaction but wish to invoke
the listener with each message individually.
- Since:
- 2.4.2
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A callback for each message. -
Method Summary
Modifier and TypeMethodDescriptionvoid
adapt
(List<org.springframework.messaging.Message<?>> messages, List<org.apache.kafka.clients.consumer.ConsumerRecord<K, V>> records, Acknowledgment ack, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, BatchToRecordAdapter.Callback<K, V> callback) Adapt the list and invoke the callback for each message.
-
Method Details
-
adapt
void adapt(List<org.springframework.messaging.Message<?>> messages, List<org.apache.kafka.clients.consumer.ConsumerRecord<K, V>> records, Acknowledgment ack, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, BatchToRecordAdapter.Callback<K, V> callback) Adapt the list and invoke the callback for each message.- Parameters:
messages
- the messages.records
- the records.ack
- the acknowledgment.consumer
- the consumer.callback
- the callback.
-