Class ConsumerRecords<K,V>
java.lang.Object
org.apache.kafka.clients.consumer.ConsumerRecords<K,V>
- All Implemented Interfaces:
Iterable<ConsumerRecord<K,
V>>
A container that holds the list
ConsumerRecord
per partition for a
particular topic. There is one ConsumerRecord
list for every topic
partition returned by a Consumer.poll(java.time.Duration)
operation.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
count()
The number of records for all topicsstatic <K,
V> ConsumerRecords<K, V> empty()
boolean
isEmpty()
iterator()
Get the partitions which have records contained in this record set.Get just the records for the given topicList<ConsumerRecord<K,
V>> records
(TopicPartition partition) Get just the records for the given partitionMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ConsumerRecords
-
-
Method Details
-
records
Get just the records for the given partition- Parameters:
partition
- The partition to get records for
-
records
Get just the records for the given topic -
partitions
Get the partitions which have records contained in this record set.- Returns:
- the set of partitions with data in this record set (may be empty if no data was returned)
-
iterator
-
count
public int count()The number of records for all topics -
isEmpty
public boolean isEmpty() -
empty
-