Interface Trigger.TriggerContext

  • All Known Subinterfaces:
    Trigger.OnMergeContext
    Enclosing class:
    Trigger<W extends Window>

    public static interface Trigger.TriggerContext
    A context object that is given to Trigger methods to allow them to register timer callbacks and deal with state.
    • Method Detail

      • getCurrentProcessingTime

        long getCurrentProcessingTime()
        Returns the current processing time.
      • getMetricGroup

        org.apache.flink.metrics.MetricGroup getMetricGroup()
        Returns the metric group for this Trigger. This is the same metric group that would be returned from RuntimeContext.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.
      • registerEventTimeTimer

        void registerEventTimeTimer​(long time)
        Register an event-time callback. When the current watermark passes the specified time Trigger.onEventTime(long, Window) is called with the time specified here.
        Parameters:
        time - The watermark at which to invoke Trigger.onEventTime(long, Window)
        See Also:
        Watermark
      • 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.
      • getShiftTimeZone

        ZoneId getShiftTimeZone()
        Returns the shifted timezone.
      • getPartitionedState

        <S extends org.apache.flink.api.common.state.State> S getPartitionedState​(org.apache.flink.api.common.state.StateDescriptor<S,​?> stateDescriptor)
        Retrieves a State 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:
        S - The type 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).