Interface AsyncTrigger.TriggerContext
- All Known Subinterfaces:
AsyncTrigger.OnMergeContext
- All Known Implementing Classes:
AsyncWindowOperator.Context
- Enclosing class:
- AsyncTrigger<T,
W extends Window>
public static interface AsyncTrigger.TriggerContext
A context object that is given to
AsyncTrigger methods to allow them to register
timer callbacks and deal with state.-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteEventTimeTimer(long time) Delete the event-time trigger for the given time.voiddeleteProcessingTimeTimer(long time) Delete the processing time trigger for the given time.longReturns the current processing time.longReturns the current watermark time.org.apache.flink.metrics.MetricGroupReturns the metric group for thisAsyncTrigger.<T,S extends org.apache.flink.api.common.state.v2.State>
SgetPartitionedState(org.apache.flink.api.common.state.v2.StateDescriptor<T> stateDescriptor) Retrieves aState(v2) object that can be used to interact with fault-tolerant state that is scoped to the window and key of the current trigger invocation.voidregisterEventTimeTimer(long time) Register an event-time callback.voidregisterProcessingTimeTimer(long time) Register a system time callback.
-
Method Details
-
getCurrentProcessingTime
long getCurrentProcessingTime()Returns the current processing time. -
getMetricGroup
org.apache.flink.metrics.MetricGroup getMetricGroup()Returns the metric group for thisAsyncTrigger. This is the same metric group that would be returned fromRuntimeContext.getMetricGroup()in a user function.You must not call methods that create metric objects (such as
MetricGroup.counter(int)multiple times but instead call once and store the metric object in a field. -
getCurrentWatermark
long getCurrentWatermark()Returns the current watermark time. -
registerProcessingTimeTimer
void registerProcessingTimeTimer(long time) Register a system time callback. When the current system time passes the specified timeAsyncTrigger.onProcessingTime(long, Window, TriggerContext)is called with the time specified here.- Parameters:
time- The time at which to invokeAsyncTrigger.onProcessingTime(long, Window, TriggerContext)
-
registerEventTimeTimer
void registerEventTimeTimer(long time) Register an event-time callback. When the current watermark passes the specified timeAsyncTrigger.onEventTime(long, Window, TriggerContext)is called with the time specified here.- Parameters:
time- The watermark at which to invokeAsyncTrigger.onEventTime(long, Window, AsyncTrigger.TriggerContext)- See Also:
-
deleteProcessingTimeTimer
void deleteProcessingTimeTimer(long time) Delete the processing time trigger for the given time. -
deleteEventTimeTimer
void deleteEventTimeTimer(long time) Delete the event-time trigger for the given time. -
getPartitionedState
<T,S extends org.apache.flink.api.common.state.v2.State> S getPartitionedState(org.apache.flink.api.common.state.v2.StateDescriptor<T> stateDescriptor) Retrieves aState(v2) object that can be used to interact with fault-tolerant state that is scoped to the window and key of the current trigger invocation.- Type Parameters:
T- The store element of the state.- Parameters:
stateDescriptor- The StateDescriptor that contains the name and type of the state that is being accessed.- Returns:
- The partitioned state object.
- Throws:
UnsupportedOperationException- Thrown, if no partitioned state is available for the function (function is not part os a KeyedStream).
-