java.lang.Object
org.apache.kafka.clients.consumer.internals.Fetch<K,V>

public class Fetch<K,V> extends Object
  • Method Details

    • empty

      public static <K, V> Fetch<K,V> empty()
    • forPartition

      public static <K, V> Fetch<K,V> forPartition(org.apache.kafka.common.TopicPartition partition, List<ConsumerRecord<K,V>> records, boolean positionAdvanced)
    • add

      public void add(Fetch<K,V> fetch)
      Add another Fetch to this one; all of its records will be added to this fetch's records() records}, and if the other fetch advanced the consume position for any topic partition, this fetch will be marked as having advanced the consume position as well.
      Parameters:
      fetch - the other fetch to add; may not be null
    • records

      public Map<org.apache.kafka.common.TopicPartition,List<ConsumerRecord<K,V>>> records()
      Returns:
      all of the non-control messages for this fetch, grouped by partition
    • positionAdvanced

      public boolean positionAdvanced()
      Returns:
      whether the fetch caused the consumer's position to advance for at least one of the topic partitions in this fetch
    • numRecords

      public int numRecords()
      Returns:
      the total number of non-control messages for this fetch, across all partitions
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if and only if this fetch did not return any user-visible (i.e., non-control) records, and did not cause the consumer position to advance for any topic partitions