Class KafkaRangeIterator<T>
java.lang.Object
no.mnemonic.messaging.documentchannel.kafka.KafkaRangeIterator<T>
- Type Parameters:
T
- type of document to return
- All Implemented Interfaces:
Iterable<KafkaDocument<T>>
,Iterator<KafkaDocument<T>>
public class KafkaRangeIterator<T>
extends Object
implements Iterator<KafkaDocument<T>>, Iterable<KafkaDocument<T>>
This iterator implementation will return a range of documents
from kafka, until the iterator reaches the cursor limit (for all partitions)
-
Constructor Summary
ConstructorDescriptionKafkaRangeIterator
(KafkaDocumentSource<T> source, String fromCursor, String toCursor) -
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.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
KafkaRangeIterator
public KafkaRangeIterator(KafkaDocumentSource<T> source, String fromCursor, String toCursor) throws KafkaInvalidSeekException, InterruptedException - Parameters:
source
- The kafka document source to read from. The source should be seeked to the proper start position.fromCursor
- aKafkaCursor
string representing the start position to iterate from, as returned from aKafkaDocument.getCursor()
. FromCursor MAY be null (will then iterate from the default starting point)toCursor
- aKafkaCursor
string representing the end of the target range, as returned from aKafkaDocument.getCursor()
. ToCursor MUST be set, or will throw IllegalArgumentException.- Throws:
KafkaInvalidSeekException
InterruptedException
-
-
Method Details