Class KafkaTopicPartitionsIterator<K,V>
java.lang.Object
com.markosindustries.distroboy.kafka.KafkaTopicPartitionsIterator<K,V>
- Type Parameters:
K
- The type of keys theKafkaConsumer
will deserialiseV
- The type of values theKafkaConsumer
will deserialise
- All Implemented Interfaces:
java.util.Iterator<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>
public class KafkaTopicPartitionsIterator<K,V>
extends java.lang.Object
implements java.util.Iterator<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>
Provides an
Iterator
interface to the data in Kafka for a given set of TopicPartition
s. Reads from the starting offsets (inclusive) to the ending offsets (exclusive)
specified.-
Constructor Summary
Constructors Constructor Description KafkaTopicPartitionsIterator(org.apache.kafka.clients.consumer.Consumer<K,V> kafkaConsumer, java.util.Collection<org.apache.kafka.common.TopicPartition> topicPartitions, KafkaOffsetSpec startOffsetsInclusiveSpec, KafkaOffsetSpec endOffsetsExclusiveSpec)
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
KafkaTopicPartitionsIterator
public KafkaTopicPartitionsIterator(org.apache.kafka.clients.consumer.Consumer<K,V> kafkaConsumer, java.util.Collection<org.apache.kafka.common.TopicPartition> topicPartitions, KafkaOffsetSpec startOffsetsInclusiveSpec, KafkaOffsetSpec endOffsetsExclusiveSpec)- Parameters:
kafkaConsumer
- AKafkaConsumer
to communicate with Kafka viatopicPartitions
- The set ofTopicPartition
s to iterate records fromstartOffsetsInclusiveSpec
- The starting offset spec (inclusive)endOffsetsExclusiveSpec
- The end offset spec (exclusive)
-
-
Method Details