public static class StreamSource.NonTimestampContext<T> extends Object implements SourceFunction.SourceContext<T>
SourceFunction.SourceContext to be used for sources that don't emit watermarks.
In addition to StreamSource.NonWatermarkContext this will also not attach timestamps to sources.
(Technically it will always set the timestamp to 0).| Constructor and Description |
|---|
StreamSource.NonTimestampContext(Object lockingObjectParam,
Output<StreamRecord<T>> outputParam) |
| 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.NonTimestampContext(Object lockingObjectParam, Output<StreamRecord<T>> outputParam)
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.