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 for every topic returned by a
Consumer.poll(long)
operation.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
|
java.util.Iterator<ConsumerRecord<K,V>> |
iterator() |
java.lang.Iterable<ConsumerRecord<K,V>> |
records(java.lang.String topic)
Get just the records for the given topic
|
java.lang.Iterable<ConsumerRecord<K,V>> |
records(TopicPartition partition)
Get just the records for the given partition
|
public ConsumerRecords(java.util.Map<TopicPartition,java.util.List<ConsumerRecord<K,V>>> records)
public java.lang.Iterable<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.Iterator<ConsumerRecord<K,V>> iterator()
iterator
in interface java.lang.Iterable<ConsumerRecord<K,V>>
public int count()