Interface TwoOutputStreamProcessFunction<IN,OUT1,OUT2>

All Superinterfaces:
org.apache.flink.api.common.functions.Function, ProcessFunction, Serializable
All Known Subinterfaces:
TwoOutputEventTimeStreamProcessFunction<IN,OUT1,OUT2>

@Experimental public interface TwoOutputStreamProcessFunction<IN,OUT1,OUT2> extends ProcessFunction
This contains all logical related to process and emit records to two output streams.
  • Method Details

    • open

      default void open(TwoOutputNonPartitionedContext<OUT1,OUT2> ctx) throws Exception
      Initialization method for the function. It is called before the actual working methods (like processRecord) and thus suitable for one time setup work.

      By default, this method does nothing.

      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.
    • processRecord

      void processRecord(IN record, Collector<OUT1> output1, Collector<OUT2> output2, TwoOutputPartitionedContext<OUT1,OUT2> ctx) throws Exception
      Process and emit record to the first/second output through Collectors.
      Parameters:
      record - to process.
      output1 - to emit processed records to the first output.
      output2 - to emit processed records to the second output.
      ctx - runtime context in which this function is executed.
      Throws:
      Exception
    • endInput

      default void endInput(TwoOutputNonPartitionedContext<OUT1,OUT2> ctx) throws Exception
      This is a life-cycle method indicates that this function will no longer receive any input data.
      Parameters:
      ctx - the context in which this function is executed.
      Throws:
      Exception
    • onProcessingTimer

      default void onProcessingTimer(long timestamp, Collector<OUT1> output1, Collector<OUT2> output2, TwoOutputPartitionedContext<OUT1,OUT2> ctx) throws Exception
      Callback for processing timer.
      Parameters:
      timestamp - when this callback is triggered.
      output1 - to emit record.
      output2 - to emit record.
      ctx - runtime context in which this function is executed.
      Throws:
      Exception
    • onWatermark

      default org.apache.flink.api.common.watermark.WatermarkHandlingResult onWatermark(org.apache.flink.api.common.watermark.Watermark watermark, Collector<OUT1> output1, Collector<OUT2> output2, TwoOutputNonPartitionedContext<OUT1,OUT2> ctx) throws Exception
      Callback function when receive the watermark from the input.
      Parameters:
      watermark - to process.
      output1 - to emit data to the first output.
      output2 - to emit data to the second output.
      ctx - runtime context in which this function is executed.
      Throws:
      Exception