Class FetchCollector<K,V>

java.lang.Object
org.apache.kafka.clients.consumer.internals.FetchCollector<K,V>
Type Parameters:
K - Record key type
V - Record value type

public class FetchCollector<K,V> extends Object
FetchCollector operates at the RecordBatch level, as that is what is stored in the FetchBuffer. Each Record in the RecordBatch is converted to a ConsumerRecord and added to the returned Fetch.
  • Constructor Details

  • Method Details

    • collectFetch

      public Fetch<K,V> collectFetch(FetchBuffer fetchBuffer)
      Return the fetched records, empty the record buffer, and update the consumed position.

      NOTE: returning an empty fetch guarantees the consumed position is not updated.
      Parameters:
      fetchBuffer - FetchBuffer from which to retrieve the records
      Returns:
      A Fetch for the requested partitions
      Throws:
      OffsetOutOfRangeException - If there is OffsetOutOfRange error in fetchResponse and the defaultResetPolicy is NONE
      org.apache.kafka.common.errors.TopicAuthorizationException - If there is TopicAuthorization error in fetchResponse.
    • initialize

      protected CompletedFetch initialize(CompletedFetch completedFetch)
      Initialize a CompletedFetch object.