Class PurgingTrigger<T,W extends Window>
java.lang.Object
org.apache.flink.streaming.api.windowing.triggers.Trigger<T,W>
org.apache.flink.streaming.api.windowing.triggers.PurgingTrigger<T,W>
- Type Parameters:
T- The type of elements on which this trigger can operate.W- The type ofWindowson which this trigger can operate.
- All Implemented Interfaces:
Serializable
A trigger that can turn any
Trigger into a purging Trigger.
When the nested trigger fires, this will return a FIRE_AND_PURGE TriggerResult.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.flink.streaming.api.windowing.triggers.Trigger
Trigger.OnMergeContext, Trigger.TriggerContext -
Method Summary
Modifier and TypeMethodDescriptionbooleancanMerge()Returns true if this trigger supports merging of trigger state and can therefore be used with aMergingWindowAssigner.voidclear(W window, Trigger.TriggerContext ctx) Clears any state that the trigger might still hold for the given window.static <T,W extends Window>
PurgingTrigger<T,W> Creates a new purging trigger from the givenTrigger.onElement(T element, long timestamp, W window, Trigger.TriggerContext ctx) Called for every element that gets added to a pane.onEventTime(long time, W window, Trigger.TriggerContext ctx) Called when an event-time timer that was set using the trigger context fires.voidonMerge(W window, Trigger.OnMergeContext ctx) Called when several windows have been merged into one window by theWindowAssigner.onProcessingTime(long time, W window, Trigger.TriggerContext ctx) Called when a processing-time timer that was set using the trigger context fires.toString()
-
Method Details
-
onElement
public TriggerResult onElement(T element, long timestamp, W window, Trigger.TriggerContext ctx) throws Exception 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<T,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
Description copied from class:TriggerCalled 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:TriggerCalled when a processing-time timer that was set using the trigger context fires. -
clear
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). -
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) -
onMerge
Description copied from class:TriggerCalled when several windows have been merged into one window by theWindowAssigner. -
toString
-
of
Creates a new purging trigger from the givenTrigger.- Parameters:
nestedTrigger- The trigger that is wrapped by this purging trigger
-
getNestedTrigger
-