public class ConsumerRecords<K,V> extends java.lang.Object implements java.lang.Iterable<ConsumerRecord<K,V>>
ConsumerRecord
per partition for a
particular topic. There is one ConsumerRecord
list for every topic
partition returned by a Consumer.poll(long)
operation.Modifier and Type | Field and Description |
---|---|
static ConsumerRecords<java.lang.Object,java.lang.Object> |
EMPTY |
Constructor and Description |
---|
ConsumerRecords(java.util.Map<TopicPartition,java.util.List<ConsumerRecord<K,V>>> records) |
Modifier and Type | Method and Description |
---|---|
int |
count()
The number of records for all topics
|
static <K,V> ConsumerRecords<K,V> |
empty() |
boolean |
isEmpty() |
java.util.Iterator<ConsumerRecord<K,V>> |
iterator() |
java.util.Set<TopicPartition> |
partitions()
Get the partitions which have records contained in this record set.
|
java.lang.Iterable<ConsumerRecord<K,V>> |
records(java.lang.String topic)
Get just the records for the given topic
|
java.util.List<ConsumerRecord<K,V>> |
records(TopicPartition partition)
Get just the records for the given partition
|
public static final ConsumerRecords<java.lang.Object,java.lang.Object> EMPTY
public ConsumerRecords(java.util.Map<TopicPartition,java.util.List<ConsumerRecord<K,V>>> records)
public java.util.List<ConsumerRecord<K,V>> records(TopicPartition partition)
partition
- The partition to get records forpublic java.lang.Iterable<ConsumerRecord<K,V>> records(java.lang.String topic)
public java.util.Set<TopicPartition> partitions()
public java.util.Iterator<ConsumerRecord<K,V>> iterator()
iterator
in interface java.lang.Iterable<ConsumerRecord<K,V>>
public int count()
public boolean isEmpty()
public static <K,V> ConsumerRecords<K,V> empty()