Class DefaultBatchToRecordAdapter<K,V>
java.lang.Object
org.springframework.kafka.listener.adapter.DefaultBatchToRecordAdapter<K,V>
- Type Parameters:
K
- the key type.V
- the value type.
- All Implemented Interfaces:
BatchToRecordAdapter<K,
V>
The default
BatchToRecordAdapter
implementation; if the supplied recoverer
throws an exception, the batch will be aborted; otherwise the next record will be
processed.- Since:
- 2.4.2
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.kafka.listener.adapter.BatchToRecordAdapter
BatchToRecordAdapter.Callback<K,
V> -
Constructor Summary
ConstructorDescriptionConstruct an instance with the default recoverer which simply logs the failed record.Construct an instance with the provided recoverer. -
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.
-
Constructor Details
-
DefaultBatchToRecordAdapter
public DefaultBatchToRecordAdapter()Construct an instance with the default recoverer which simply logs the failed record. -
DefaultBatchToRecordAdapter
Construct an instance with the provided recoverer.- Parameters:
recoverer
- the recoverer.
-
-
Method Details
-
adapt
public 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) Description copied from interface:BatchToRecordAdapter
Adapt the list and invoke the callback for each message.- Specified by:
adapt
in interfaceBatchToRecordAdapter<K,
V> - Parameters:
messages
- the messages.records
- the records.ack
- the acknowledgment.consumer
- the consumer.callback
- the callback.
-