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 Object implements 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
Author:
Gary Russell
  • Constructor Details

    • 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 Details

    • adapt

      public void adapt(List<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 interface BatchToRecordAdapter<K,V>
      Parameters:
      messages - the messages.
      records - the records.
      ack - the acknowledgment.
      consumer - the consumer.
      callback - the callback.