Class 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 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 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 interface BatchToRecordAdapter<K,​V>
        Parameters:
        messages - the messages.
        records - the records.
        ack - the acknowledgment.
        consumer - the consumer.
        callback - the callback.