Class ProcessFunction<I,​O>

    • Constructor Detail

      • ProcessFunction

        public ProcessFunction()
    • Method Detail

      • processElement

        public abstract void processElement​(I value,
                                            ProcessFunction.Context ctx,
                                            Collector<O> out)
                                     throws Exception
        Process one element from the input stream.

        This function can output zero or more elements using the Collector parameter and also update internal state or set timers using the ProcessFunction.Context parameter.

        Parameters:
        value - The input value.
        ctx - A ProcessFunction.Context that allows querying the timestamp of the element and getting a TimerService for registering timers and querying the time. The context is only valid during the invocation of this method, do not store it.
        out - The collector for returning result values.
        Throws:
        Exception - This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.
      • onTimer

        public void onTimer​(long timestamp,
                            ProcessFunction.OnTimerContext ctx,
                            Collector<O> out)
                     throws Exception
        Called when a timer set using TimerService fires.
        Parameters:
        timestamp - The timestamp of the firing timer.
        ctx - An ProcessFunction.OnTimerContext that allows querying the timestamp of the firing timer, querying the TimeDomain of the firing timer and getting a TimerService for registering timers and querying the time. The context is only valid during the invocation of this method, do not store it.
        out - The collector for returning result values.
        Throws:
        Exception - This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.