T - The type of the elements produced by the source.public static interface SourceFunction.SourceContext<T>
collect(T). If the source is a
Checkpointed source it must retrieve
the checkpoint lock object and use it to protect state updates and element emission as
described in SourceFunction.| 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.
|
void collect(T element)
System.currentTimeMillis() is set as
the timestamp of the emitted element.element - The element to emitvoid collectWithTimestamp(T element, long timestamp)
element - The element to emittimestamp - The timestamp in millisecondsvoid emitWatermark(Watermark mark)
Watermark.
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.
mark - The Watermark to emitObject getCheckpointLock()
SourceFunction.void close()
SourceFunction.SourceContext
to clean up internal state.Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.