Class ProcessingTimeoutTrigger<T,W extends org.apache.flink.streaming.api.windowing.windows.Window>
- java.lang.Object
-
- org.apache.flink.streaming.api.windowing.triggers.Trigger<T,W>
-
- org.apache.flink.streaming.api.windowing.triggers.ProcessingTimeoutTrigger<T,W>
-
- Type Parameters:
T
- The type of elements on which this trigger can operate.W
- The type ofWindow
on which this trigger can operate.
- All Implemented Interfaces:
Serializable
@PublicEvolving public class ProcessingTimeoutTrigger<T,W extends org.apache.flink.streaming.api.windowing.windows.Window> extends org.apache.flink.streaming.api.windowing.triggers.Trigger<T,W>
ATrigger
that can turn anyTrigger
into a timeoutTrigger
.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 specifyingresetTimerOnNewRecord
and you can specify whetherTrigger.clear(Window, TriggerContext)
should be called on timout viashouldClearOnTimeout
.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx)
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 newProcessingTimeoutTrigger
that 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 newProcessingTimeoutTrigger
that fires when the inner trigger is fired or when the timeout timer fires.org.apache.flink.streaming.api.windowing.triggers.TriggerResult
onElement(T element, long timestamp, W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx)
org.apache.flink.streaming.api.windowing.triggers.TriggerResult
onEventTime(long timestamp, W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx)
org.apache.flink.streaming.api.windowing.triggers.TriggerResult
onProcessingTime(long timestamp, W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx)
String
toString()
-
-
-
Method Detail
-
onElement
public org.apache.flink.streaming.api.windowing.triggers.TriggerResult onElement(T element, long timestamp, W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx) throws Exception
-
onProcessingTime
public org.apache.flink.streaming.api.windowing.triggers.TriggerResult onProcessingTime(long timestamp, W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx) throws Exception
-
onEventTime
public org.apache.flink.streaming.api.windowing.triggers.TriggerResult onEventTime(long timestamp, W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx) throws Exception
-
clear
public void clear(W window, org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext ctx) throws Exception
-
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 newProcessingTimeoutTrigger
that 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 nestedTrigger
timeout
- the timeout interval- Returns:
ProcessingTimeoutTrigger
with 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 newProcessingTimeoutTrigger
that 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 ofWindows
on which this trigger can operate.- Parameters:
nestedTrigger
- the nestedTrigger
timeout
- 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:
ProcessingTimeoutTrigger
with the above configuration.
-
-