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.

    @FunctionalInterface
    public interface BatchToRecordAdapter<K,​V>
    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
    Author:
    Gary Russell
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  BatchToRecordAdapter.Callback<K,​V>
      A callback for each message.
    • Method Summary

      All Methods Instance Methods Abstract 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.
    • Method Detail

      • adapt

        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.
        Parameters:
        messages - the messages.
        records - the records.
        ack - the acknowledgment.
        consumer - the consumer.
        callback - the callback.