Class ProcessingTimeoutTrigger<T,W extends org.apache.flink.streaming.api.windowing.windows.Window>
- Type Parameters:
T- The type of elements on which this trigger can operate.W- The type ofWindowon which this trigger can operate.
- All Implemented Interfaces:
Serializable
Trigger that can turn any Trigger into a timeout Trigger.
On the first arriving element a configurable processing-time timeout will be set. Using of(Trigger, Duration, boolean, boolean), you can also re-new the timer for each arriving
element by specifying resetTimerOnNewRecord and you can specify whether Trigger.clear(Window, TriggerContext) should be called on timout via
shouldClearOnTimeout.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.flink.streaming.api.windowing.triggers.Trigger
org.apache.flink.streaming.api.windowing.triggers.Trigger.OnMergeContext, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic <T,W extends org.apache.flink.streaming.api.windowing.windows.Window>
ProcessingTimeoutTrigger<T,W> Creates a newProcessingTimeoutTriggerthat fires when the inner trigger is fired or when the timeout timer fires.static <T,W extends org.apache.flink.streaming.api.windowing.windows.Window>
ProcessingTimeoutTrigger<T,W> of(org.apache.flink.streaming.api.windowing.triggers.Trigger<T, W> nestedTrigger, Duration timeout, boolean resetTimerOnNewRecord, boolean shouldClearOnTimeout) Creates a newProcessingTimeoutTriggerthat fires when the inner trigger is fired or when the timeout timer fires.org.apache.flink.streaming.api.windowing.triggers.TriggerResultonElement(T element, long timestamp, W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx) org.apache.flink.streaming.api.windowing.triggers.TriggerResultonEventTime(long timestamp, W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx) org.apache.flink.streaming.api.windowing.triggers.TriggerResultonProcessingTime(long timestamp, W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx) toString()Methods inherited from class org.apache.flink.streaming.api.windowing.triggers.Trigger
canMerge, onMerge
-
Method Details
-
onElement
-
onProcessingTime
-
onEventTime
-
clear
-
toString
-
of
public static <T,W extends org.apache.flink.streaming.api.windowing.windows.Window> ProcessingTimeoutTrigger<T,W> of(org.apache.flink.streaming.api.windowing.triggers.Trigger<T, W> nestedTrigger, Duration timeout) Creates a newProcessingTimeoutTriggerthat fires when the inner trigger is fired or when the timeout timer fires.For example:
ProcessingTimeoutTrigger.of(CountTrigger.of(3), 100), will create a CountTrigger with timeout of 100 millis. So, if the first record arrives at timet, and the second record arrives at timet+50, the trigger will fire when the third record arrives or when the time is {code t+100} (timeout).- Parameters:
nestedTrigger- the nestedTriggertimeout- the timeout interval- Returns:
ProcessingTimeoutTriggerwith the above configuration.
-
of
public static <T,W extends org.apache.flink.streaming.api.windowing.windows.Window> ProcessingTimeoutTrigger<T,W> of(org.apache.flink.streaming.api.windowing.triggers.Trigger<T, W> nestedTrigger, Duration timeout, boolean resetTimerOnNewRecord, boolean shouldClearOnTimeout) Creates a newProcessingTimeoutTriggerthat fires when the inner trigger is fired or when the timeout timer fires.For example:
ProcessingTimeoutTrigger.of(CountTrigger.of(3), 100, false, true), will create a CountTrigger with timeout of 100 millis. So, if the first record arrives at timet, and the second record arrives at timet+50, the trigger will fire when the third record arrives or when the time is {code t+100} (timeout).- Type Parameters:
T- The type of the element.W- The type ofWindowson which this trigger can operate.- Parameters:
nestedTrigger- the nestedTriggertimeout- the timeout intervalresetTimerOnNewRecord- each time a new element arrives, reset the timer and start a new oneshouldClearOnTimeout- whether to callTrigger.clear(Window, TriggerContext)when the processing-time timer fires- Returns:
ProcessingTimeoutTriggerwith the above configuration.
-