Class AsyncProcessingTimeoutTrigger<T,W extends org.apache.flink.streaming.api.windowing.windows.Window>
- java.lang.Object
-
- org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger<T,W>
-
- org.apache.flink.streaming.api.windowing.triggers.AsyncProcessingTimeoutTrigger<T,W>
-
- 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
@Experimental public class AsyncProcessingTimeoutTrigger<T,W extends org.apache.flink.streaming.api.windowing.windows.Window> extends org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger<T,W>AAsyncTriggerthat can turn anyAsyncTriggerinto a timeoutAsyncTrigger.On the first arriving element a configurable processing-time timeout will be set. Using
of(AsyncTrigger, Duration, boolean, boolean), you can also re-new the timer for each arriving element by specifyingresetTimerOnNewRecordand you can specify whetherAsyncTrigger.clear(Window, AsyncTrigger.TriggerContext)should be called on timout viashouldClearOnTimeout.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger
org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger.OnMergeContext, org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger.TriggerContext
-
-
Constructor Summary
Constructors Constructor Description AsyncProcessingTimeoutTrigger(org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger<T,W> nestedTrigger, long interval, boolean resetTimerOnNewRecord, boolean shouldClearOnTimeout)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.flink.api.common.state.v2.StateFuture<Void>clear(W window, org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger.TriggerContext ctx)longgetInterval()org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger<T,W>getNestedTrigger()org.apache.flink.api.common.state.v2.ValueStateDescriptor<Long>getTimeoutStateDesc()booleanisResetTimerOnNewRecord()booleanisShouldClearOnTimeout()static <T,W extends org.apache.flink.streaming.api.windowing.windows.Window>
AsyncProcessingTimeoutTrigger<T,W>of(org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger<T,W> nestedTrigger, Duration timeout)Creates a newAsyncProcessingTimeoutTriggerthat 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>
AsyncProcessingTimeoutTrigger<T,W>of(org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger<T,W> nestedTrigger, Duration timeout, boolean resetTimerOnNewRecord, boolean shouldClearOnTimeout)Creates a newAsyncProcessingTimeoutTriggerthat fires when the inner trigger is fired or when the timeout timer fires.org.apache.flink.api.common.state.v2.StateFuture<org.apache.flink.streaming.api.windowing.triggers.TriggerResult>onElement(T element, long timestamp, W window, org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger.TriggerContext ctx)org.apache.flink.api.common.state.v2.StateFuture<org.apache.flink.streaming.api.windowing.triggers.TriggerResult>onEventTime(long time, W window, org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger.TriggerContext ctx)org.apache.flink.api.common.state.v2.StateFuture<org.apache.flink.streaming.api.windowing.triggers.TriggerResult>onProcessingTime(long time, W window, org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger.TriggerContext ctx)StringtoString()
-
-
-
Method Detail
-
onElement
public org.apache.flink.api.common.state.v2.StateFuture<org.apache.flink.streaming.api.windowing.triggers.TriggerResult> onElement(T element, long timestamp, W window, org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger.TriggerContext ctx) throws Exception
-
onProcessingTime
public org.apache.flink.api.common.state.v2.StateFuture<org.apache.flink.streaming.api.windowing.triggers.TriggerResult> onProcessingTime(long time, W window, org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger.TriggerContext ctx) throws Exception
-
onEventTime
public org.apache.flink.api.common.state.v2.StateFuture<org.apache.flink.streaming.api.windowing.triggers.TriggerResult> onEventTime(long time, W window, org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger.TriggerContext ctx) throws Exception
-
clear
public org.apache.flink.api.common.state.v2.StateFuture<Void> clear(W window, org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger.TriggerContext ctx) throws Exception
-
of
public static <T,W extends org.apache.flink.streaming.api.windowing.windows.Window> AsyncProcessingTimeoutTrigger<T,W> of(org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger<T,W> nestedTrigger, Duration timeout)
Creates a newAsyncProcessingTimeoutTriggerthat fires when the inner trigger is fired or when the timeout timer fires.For example:
AsyncProcessingTimeoutTrigger.of(AsyncCountTrigger.of(3), 100), will create a AsyncCountTrigger 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 nestedAsyncTriggertimeout- the timeout interval- Returns:
AsyncProcessingTimeoutTriggerwith the above configuration.
-
of
public static <T,W extends org.apache.flink.streaming.api.windowing.windows.Window> AsyncProcessingTimeoutTrigger<T,W> of(org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger<T,W> nestedTrigger, Duration timeout, boolean resetTimerOnNewRecord, boolean shouldClearOnTimeout)
Creates a newAsyncProcessingTimeoutTriggerthat fires when the inner trigger is fired or when the timeout timer fires.For example:
AsyncProcessingTimeoutTrigger.of(CountTrigger.of(3), 100, false, true), will create a AsyncCountTrigger 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 nestedAsyncTriggertimeout- the timeout intervalresetTimerOnNewRecord- each time a new element arrives, reset the timer and start a new oneshouldClearOnTimeout- whether to callAsyncTrigger.clear(Window, AsyncTrigger.TriggerContext)when the processing-time timer fires- Returns:
AsyncProcessingTimeoutTriggerwith the above configuration.
-
getNestedTrigger
@VisibleForTesting public org.apache.flink.runtime.asyncprocessing.operators.windowing.triggers.AsyncTrigger<T,W> getNestedTrigger()
-
getInterval
@VisibleForTesting public long getInterval()
-
isResetTimerOnNewRecord
@VisibleForTesting public boolean isResetTimerOnNewRecord()
-
isShouldClearOnTimeout
@VisibleForTesting public boolean isShouldClearOnTimeout()
-
getTimeoutStateDesc
@VisibleForTesting public org.apache.flink.api.common.state.v2.ValueStateDescriptor<Long> getTimeoutStateDesc()
-
-