Interface ProcessFunction

All Superinterfaces:
org.apache.flink.api.common.functions.Function, Serializable
All Known Subinterfaces:
EventTimeProcessFunction, OneInputEventTimeStreamProcessFunction<IN,OUT>, OneInputStreamProcessFunction<IN,OUT>, OneInputWindowStreamProcessFunction<IN,OUT>, TwoInputBroadcastEventTimeStreamProcessFunction<IN1,IN2,OUT>, TwoInputBroadcastStreamProcessFunction<IN1,IN2,OUT>, TwoInputNonBroadcastEventTimeStreamProcessFunction<IN1,IN2,OUT>, TwoInputNonBroadcastStreamProcessFunction<IN1,IN2,OUT>, TwoInputNonBroadcastWindowStreamProcessFunction<IN1,IN2,OUT>, TwoOutputEventTimeStreamProcessFunction<IN,OUT1,OUT2>, TwoOutputStreamProcessFunction<IN,OUT1,OUT2>, TwoOutputWindowStreamProcessFunction<IN,OUT1,OUT2>, WindowProcessFunction

@Experimental public interface ProcessFunction extends org.apache.flink.api.common.functions.Function
Base class for all user defined process functions.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Tear-down method for the user code.
    default Set<? extends org.apache.flink.api.common.watermark.WatermarkDeclaration>
    Explicitly declare watermarks upfront.
    default Set<org.apache.flink.api.common.state.StateDeclaration>
    Explicitly declares states upfront.
  • Method Details

    • usesStates

      default Set<org.apache.flink.api.common.state.StateDeclaration> usesStates()
      Explicitly declares states upfront. Each specific state must be declared in this method before it can be used.
      Returns:
      all declared states used by this process function.
    • declareWatermarks

      default Set<? extends org.apache.flink.api.common.watermark.WatermarkDeclaration> declareWatermarks()
      Explicitly declare watermarks upfront. Each specific watermark must be declared in this method before it can be used.
      Returns:
      all watermark declarations used by this application.
    • close

      default void close() throws Exception
      Tear-down method for the user code. It is called after the last call to the main working methods (e.g. processRecord).

      This method can be used for clean up work.

      Throws:
      Exception - Implementations may forward exceptions, which are caught by the runtime. When the runtime catches an exception, it aborts the task and lets the fail-over logic decide whether to retry the task execution.