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>
public class DefaultBatchToRecordAdapter<K,V> extends java.lang.Object implements BatchToRecordAdapter<K,V>
The defaultBatchToRecordAdapter
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
Constructors Constructor Description DefaultBatchToRecordAdapter()
Construct an instance with the default recoverer which simply logs the failed record.DefaultBatchToRecordAdapter(ConsumerRecordRecoverer recoverer)
Construct an instance with the provided recoverer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
adapt(java.util.List<org.springframework.messaging.Message<?>> messages, java.util.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 Detail
-
DefaultBatchToRecordAdapter
public DefaultBatchToRecordAdapter()
Construct an instance with the default recoverer which simply logs the failed record.
-
DefaultBatchToRecordAdapter
public DefaultBatchToRecordAdapter(ConsumerRecordRecoverer recoverer)
Construct an instance with the provided recoverer.- Parameters:
recoverer
- the recoverer.
-
-
Method Detail
-
adapt
public void adapt(java.util.List<org.springframework.messaging.Message<?>> messages, java.util.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.
-
-