Interface TwoOutputStreamProcessFunction<IN,OUT1,OUT2>
- All Superinterfaces:
org.apache.flink.api.common.functions.Function,ProcessFunction,Serializable
- All Known Subinterfaces:
TwoOutputEventTimeStreamProcessFunction<IN,OUT1, OUT2>
This contains all logical related to process and emit records to two output streams.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidThis is a life-cycle method indicates that this function will no longer receive any input data.default voidonProcessingTimer(long timestamp, Collector<OUT1> output1, Collector<OUT2> output2, TwoOutputPartitionedContext<OUT1, OUT2> ctx) Callback for processing timer.default org.apache.flink.api.common.watermark.WatermarkHandlingResultonWatermark(org.apache.flink.api.common.watermark.Watermark watermark, Collector<OUT1> output1, Collector<OUT2> output2, TwoOutputNonPartitionedContext<OUT1, OUT2> ctx) Callback function when receive the watermark from the input.default voidInitialization method for the function.voidprocessRecord(IN record, Collector<OUT1> output1, Collector<OUT2> output2, TwoOutputPartitionedContext<OUT1, OUT2> ctx) Process and emit record to the first/second output throughCollectors.Methods inherited from interface org.apache.flink.datastream.api.function.ProcessFunction
close, declareWatermarks, usesStates
-
Method Details
-
open
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 ExceptionProcess and emit record to the first/second output throughCollectors.- 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
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 ExceptionCallback 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 ExceptionCallback 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
-