Package org.apache.beam.sdk.io
Class CountingSource.CounterMark
java.lang.Object
org.apache.beam.sdk.io.CountingSource.CounterMark
- All Implemented Interfaces:
UnboundedSource.CheckpointMark
- Enclosing class:
CountingSource
@DefaultCoder(CounterMarkCoder.class)
public static class CountingSource.CounterMark
extends Object
implements UnboundedSource.CheckpointMark
The checkpoint for an unbounded
CountingSource
is simply the last value produced. The
associated source object encapsulates the information needed to produce the next value.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.beam.sdk.io.UnboundedSource.CheckpointMark
UnboundedSource.CheckpointMark.NoopCheckpointMark
-
Field Summary
Fields inherited from interface org.apache.beam.sdk.io.UnboundedSource.CheckpointMark
NOOP_CHECKPOINT_MARK
-
Constructor Summary
ConstructorsConstructorDescriptionCounterMark
(long lastEmitted, Instant startTime) Creates a checkpoint mark reflecting the last emitted value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called by the system to signal that this checkpoint mark has been committed along with all the records which have been read from theUnboundedSource.UnboundedReader
since the previous checkpoint was taken.long
Returns the last value emitted by the reader.Returns the time the reader was started.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.beam.sdk.io.UnboundedSource.CheckpointMark
getOffsetLimit
-
Constructor Details
-
CounterMark
Creates a checkpoint mark reflecting the last emitted value.
-
-
Method Details
-
getLastEmitted
public long getLastEmitted()Returns the last value emitted by the reader. -
getStartTime
Returns the time the reader was started. -
finalizeCheckpoint
Description copied from interface:UnboundedSource.CheckpointMark
Called by the system to signal that this checkpoint mark has been committed along with all the records which have been read from theUnboundedSource.UnboundedReader
since the previous checkpoint was taken.For example, this method could send acknowledgements to an external data source such as Pubsub.
Note that:
- This finalize method may be called from any thread, concurrently with calls to the
UnboundedSource.UnboundedReader
it was created from. - Checkpoints will not necessarily be finalized as soon as they are created. A checkpoint
may be taken while a previous checkpoint from the same
UnboundedSource.UnboundedReader
has not yet be finalized. - In the absence of failures, all checkpoints will be finalized and they will be
finalized in the same order they were taken from the
UnboundedSource.UnboundedReader
. - It is possible for a checkpoint to be taken but this method never called. This method will never be called if the checkpoint could not be committed, and other failures may cause this method to never be called.
- It is not safe to assume the
UnboundedSource.UnboundedReader
from which this checkpoint was created still exists at the time this method is called.
- Specified by:
finalizeCheckpoint
in interfaceUnboundedSource.CheckpointMark
- Throws:
IOException
- This finalize method may be called from any thread, concurrently with calls to the
-