T
- The type of the elements produced by the source.@Public public static interface SourceFunction.SourceContext<T>
Modifier and Type | Method and Description |
---|---|
void |
close()
This method is called by the system to shut down the context.
|
void |
collect(T element)
Emits one element from the source, without attaching a timestamp.
|
void |
collectWithTimestamp(T element,
long timestamp)
Emits one element from the source, and attaches the given timestamp.
|
void |
emitWatermark(Watermark mark)
Emits the given
Watermark . |
Object |
getCheckpointLock()
Returns the checkpoint lock.
|
void |
markAsTemporarilyIdle()
Marks the source to be temporarily idle.
|
void collect(T element)
The element will have no timestamp initially. If timestamps and watermarks are
required, for example for event-time windows, timers, or joins, then you need to assign a
timestamp via DataStream.assignTimestampsAndWatermarks(WatermarkStrategy)
and set
a strategy that assigns timestamps (for example using WatermarkStrategy.withTimestampAssigner(TimestampAssignerSupplier)
).
element
- The element to emit@PublicEvolving void collectWithTimestamp(T element, long timestamp)
element
- The element to emittimestamp
- The timestamp in milliseconds since the Epoch@PublicEvolving void emitWatermark(Watermark mark)
Watermark
. A Watermark of value t
declares that no
elements with a timestamp t' <= t
will occur any more. If further such elements
will be emitted, those elements are considered late.mark
- The Watermark to emit@PublicEvolving void markAsTemporarilyIdle()
Source functions should make a best effort to call this method as soon as they
acknowledge themselves to be idle. The system will consider the source to resume activity
again once SourceContext#collect(T)
, SourceContext#collectWithTimestamp(T,
long)
, or emitWatermark(Watermark)
is called to emit elements or
watermarks from the source.
Object getCheckpointLock()
SourceFunction
for details about how to write a consistent checkpointed source.void close()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.