Class PubSubSplitIterator
java.lang.Object
com.linkedin.venice.vpj.pubsub.input.PubSubSplitIterator
- All Implemented Interfaces:
AutoCloseable
PubSubSplitIterator provides an iterator-like abstraction over a bounded range
of messages from a PubSubConsumerAdapter. It is designed for Venice Push Job
(VPJ) repush use cases where a split of a topic-partition needs
to be consumed deterministically between a start and an end position.
This class:
- Subscribes a
PubSubConsumerAdapterto a specificPubSubTopicPartition. - Starts reading from a caller-specified
PubSubPosition(inclusive) and stops when reaching the end-exclusive position or the record count limit. - Supports both numeric offsets and logical index–based offsets for progress tracking.
- Skips control messages transparently while tracking statistics about consumption.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final longstatic final long -
Constructor Summary
ConstructorsConstructorDescriptionPubSubSplitIterator(PubSubConsumerAdapter pubSubConsumer, PubSubPartitionSplit split, boolean useLogicalIndexOffset) PubSubSplitIterator(PubSubConsumerAdapter pubSubConsumer, PubSubPartitionSplit split, boolean useLogicalIndexOffset, long pollTimeoutMs, int emptyRetryTimes, long emptySleepMs) -
Method Summary
-
Field Details
-
DEFAULT_POLL_TIMEOUT_MS
public static final long DEFAULT_POLL_TIMEOUT_MS -
DEFAULT_EMPTY_RESULT_RETRIES
public static final int DEFAULT_EMPTY_RESULT_RETRIES- See Also:
-
DEFAULT_EMPTY_SLEEP_MS
public static final long DEFAULT_EMPTY_SLEEP_MS
-
-
Constructor Details
-
PubSubSplitIterator
public PubSubSplitIterator(PubSubConsumerAdapter pubSubConsumer, PubSubPartitionSplit split, boolean useLogicalIndexOffset, long pollTimeoutMs, int emptyRetryTimes, long emptySleepMs) -
PubSubSplitIterator
public PubSubSplitIterator(PubSubConsumerAdapter pubSubConsumer, PubSubPartitionSplit split, boolean useLogicalIndexOffset)
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
- Throws:
IOException
-
getProgress
public float getProgress() -
recordsRead
public long recordsRead() -
getCurrentPosition
-
getTopicPartition
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-