Class Fetch<K,V>
java.lang.Object
org.apache.kafka.clients.consumer.internals.Fetch<K,V>
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd anotherFetchto this one; all of its records will be added to this fetch'srecords()records}, and if the other fetchadvanced the consume position for any topic partition, this fetch will be marked as having advanced the consume position as well.static <K,V> Fetch <K, V> empty()static <K,V> Fetch <K, V> forPartition(org.apache.kafka.common.TopicPartition partition, List<ConsumerRecord<K, V>> records, boolean positionAdvanced) booleanisEmpty()intbooleanMap<org.apache.kafka.common.TopicPartition, List<ConsumerRecord<K, V>>> records()
-
Method Details
-
empty
-
forPartition
public static <K,V> Fetch<K,V> forPartition(org.apache.kafka.common.TopicPartition partition, List<ConsumerRecord<K, V>> records, boolean positionAdvanced) -
add
Add anotherFetchto this one; all of its records will be added to this fetch'srecords()records}, and if the other fetchadvanced 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
- 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
positionto 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:
trueif 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
-