public static class StreamSource.ManualWatermarkContext<T> extends Object implements SourceFunction.SourceContext<T>
SourceFunction.SourceContext to be used for sources with manual timestamp
assignment and manual watermark emission.| Constructor and Description |
|---|
StreamSource.ManualWatermarkContext(Object lockingObject,
Output<StreamRecord<T>> output) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This must be called when closing the source operator to allow the
SourceFunction.SourceContext
to clean up internal state. |
void |
collect(T element)
Emits one element from the source.
|
void |
collectWithTimestamp(T element,
long timestamp)
Emits one element from the source with the given timestamp.
|
void |
emitWatermark(Watermark mark)
Emits the given
Watermark. |
Object |
getCheckpointLock()
Returns the checkpoint lock.
|
public StreamSource.ManualWatermarkContext(Object lockingObject, Output<StreamRecord<T>> output)
public void collect(T element)
SourceFunction.SourceContextSystem.currentTimeMillis() is set as
the timestamp of the emitted element.collect in interface SourceFunction.SourceContext<T>element - The element to emitpublic void collectWithTimestamp(T element, long timestamp)
SourceFunction.SourceContextcollectWithTimestamp in interface SourceFunction.SourceContext<T>element - The element to emittimestamp - The timestamp in millisecondspublic void emitWatermark(Watermark mark)
SourceFunction.SourceContextWatermark.
Important:
Sources must only manually emit watermarks when they implement
EventTimeSourceFunction.
Otherwise, elements automatically get the current timestamp assigned at ingress
and the system automatically emits watermarks.
emitWatermark in interface SourceFunction.SourceContext<T>mark - The Watermark to emitpublic Object getCheckpointLock()
SourceFunction.SourceContextSourceFunction.getCheckpointLock in interface SourceFunction.SourceContext<T>public void close()
SourceFunction.SourceContextSourceFunction.SourceContext
to clean up internal state.close in interface SourceFunction.SourceContext<T>Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.