Class ProcessingTimeTrigger
- java.lang.Object
-
- org.apache.flink.streaming.api.windowing.triggers.Trigger<Object,TimeWindow>
-
- org.apache.flink.streaming.api.windowing.triggers.ProcessingTimeTrigger
-
- All Implemented Interfaces:
Serializable
@PublicEvolving public class ProcessingTimeTrigger extends Trigger<Object,TimeWindow>
ATriggerthat fires once the current system time passes the end of the window to which a pane belongs.- See Also:
- 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 booleancanMerge()Returns true if this trigger supports merging of trigger state and can therefore be used with aMergingWindowAssigner.voidclear(TimeWindow window, Trigger.TriggerContext ctx)Clears any state that the trigger might still hold for the given window.static ProcessingTimeTriggercreate()Creates a new trigger that fires once system time passes the end of the window.TriggerResultonElement(Object element, long timestamp, TimeWindow window, Trigger.TriggerContext ctx)Called for every element that gets added to a pane.TriggerResultonEventTime(long time, TimeWindow window, Trigger.TriggerContext ctx)Called when an event-time timer that was set using the trigger context fires.voidonMerge(TimeWindow window, Trigger.OnMergeContext ctx)Called when several windows have been merged into one window by theWindowAssigner.TriggerResultonProcessingTime(long time, TimeWindow window, Trigger.TriggerContext ctx)Called when a processing-time timer that was set using the trigger context fires.StringtoString()
-
-
-
Method Detail
-
onElement
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, Trigger.TriggerContext ctx)
Description copied from class:TriggerCalled 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:
onElementin classTrigger<Object,TimeWindow>- 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.
-
onEventTime
public TriggerResult onEventTime(long time, TimeWindow window, Trigger.TriggerContext ctx) throws Exception
Description copied from class:TriggerCalled when an event-time timer that was set using the trigger context fires.- Specified by:
onEventTimein classTrigger<Object,TimeWindow>- Parameters:
time- The timestamp at which the timer fired.window- The window for which the timer fired.ctx- A context object that can be used to register timer callbacks.- Throws:
Exception
-
onProcessingTime
public TriggerResult onProcessingTime(long time, TimeWindow window, Trigger.TriggerContext ctx)
Description copied from class:TriggerCalled when a processing-time timer that was set using the trigger context fires.- Specified by:
onProcessingTimein classTrigger<Object,TimeWindow>- Parameters:
time- The timestamp at which the timer fired.window- The window for which the timer fired.ctx- A context object that can be used to register timer callbacks.
-
clear
public void clear(TimeWindow window, Trigger.TriggerContext ctx) throws Exception
Description copied from class:TriggerClears 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).- Specified by:
clearin classTrigger<Object,TimeWindow>- Throws:
Exception
-
canMerge
public boolean canMerge()
Description copied from class:TriggerReturns true if this trigger supports merging of trigger state and can therefore be used with aMergingWindowAssigner.If this returns
trueyou must properly implementTrigger.onMerge(Window, OnMergeContext)- Overrides:
canMergein classTrigger<Object,TimeWindow>
-
onMerge
public void onMerge(TimeWindow window, Trigger.OnMergeContext ctx)
Description copied from class:TriggerCalled when several windows have been merged into one window by theWindowAssigner.- Overrides:
onMergein classTrigger<Object,TimeWindow>- Parameters:
window- The new window that results from the merge.ctx- A context object that can be used to register timer callbacks and access state.
-
create
public static ProcessingTimeTrigger create()
Creates a new trigger that fires once system time passes the end of the window.
-
-