Class ContinuousEventTimeTrigger<W extends Window>
- java.lang.Object
-
- org.apache.flink.streaming.api.windowing.triggers.Trigger<Object,W>
-
- org.apache.flink.streaming.api.windowing.triggers.ContinuousEventTimeTrigger<W>
-
- Type Parameters:
W
- The type ofWindows
on which this trigger can operate.
- All Implemented Interfaces:
Serializable
@PublicEvolving public class ContinuousEventTimeTrigger<W extends Window> extends Trigger<Object,W>
ATrigger
that continuously fires based on a given time interval. This fires based onWatermarks
.- See Also:
Watermark
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.streaming.api.windowing.triggers.Trigger
Trigger.OnMergeContext, Trigger.TriggerContext
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canMerge()
Returns true if this trigger supports merging of trigger state and can therefore be used with aMergingWindowAssigner
.void
clear(W window, Trigger.TriggerContext ctx)
Clears any state that the trigger might still hold for the given window.long
getInterval()
static <W extends Window>
ContinuousEventTimeTrigger<W>of(Duration interval)
Creates a trigger that continuously fires based on the given interval.TriggerResult
onElement(Object element, long timestamp, W window, Trigger.TriggerContext ctx)
Called for every element that gets added to a pane.TriggerResult
onEventTime(long time, W window, Trigger.TriggerContext ctx)
Called when an event-time timer that was set using the trigger context fires.void
onMerge(W window, Trigger.OnMergeContext ctx)
Called when several windows have been merged into one window by theWindowAssigner
.TriggerResult
onProcessingTime(long time, W window, Trigger.TriggerContext ctx)
Called when a processing-time timer that was set using the trigger context fires.String
toString()
-
-
-
Method Detail
-
onElement
public TriggerResult onElement(Object element, long timestamp, W window, Trigger.TriggerContext ctx) throws Exception
Description copied from class:Trigger
Called for every element that gets added to a pane. The result of this will determine whether the pane is evaluated to emit results.- Specified by:
onElement
in classTrigger<Object,W extends Window>
- Parameters:
element
- The element that arrived.timestamp
- The timestamp of the element that arrived.window
- The window to which the element is being added.ctx
- A context object that can be used to register timer callbacks.- Throws:
Exception
-
onEventTime
public TriggerResult onEventTime(long time, W window, Trigger.TriggerContext ctx) throws Exception
Description copied from class:Trigger
Called when an event-time timer that was set using the trigger context fires.
-
onProcessingTime
public TriggerResult onProcessingTime(long time, W window, Trigger.TriggerContext ctx) throws Exception
Description copied from class:Trigger
Called when a processing-time timer that was set using the trigger context fires.
-
clear
public void clear(W window, Trigger.TriggerContext ctx) throws Exception
Description copied from class:Trigger
Clears any state that the trigger might still hold for the given window. This is called when a window is purged. Timers set usingTrigger.TriggerContext.registerEventTimeTimer(long)
andTrigger.TriggerContext.registerProcessingTimeTimer(long)
should be deleted here as well as state acquired usingTrigger.TriggerContext.getPartitionedState(StateDescriptor)
.
-
canMerge
public boolean canMerge()
Description copied from class:Trigger
Returns true if this trigger supports merging of trigger state and can therefore be used with aMergingWindowAssigner
.If this returns
true
you must properly implementTrigger.onMerge(Window, OnMergeContext)
-
onMerge
public void onMerge(W window, Trigger.OnMergeContext ctx) throws Exception
Description copied from class:Trigger
Called when several windows have been merged into one window by theWindowAssigner
.
-
getInterval
@VisibleForTesting public long getInterval()
-
of
public static <W extends Window> ContinuousEventTimeTrigger<W> of(Duration interval)
Creates a trigger that continuously fires based on the given interval.- Type Parameters:
W
- The type ofWindows
on which this trigger can operate.- Parameters:
interval
- The time interval at which to fire.
-
-