Interface TwoInputBroadcastStreamProcessFunction<IN1,IN2,OUT>
- All Superinterfaces:
org.apache.flink.api.common.functions.Function,ProcessFunction,Serializable
- All Known Subinterfaces:
TwoInputBroadcastEventTimeStreamProcessFunction<IN1,IN2, OUT>
@Experimental
public interface TwoInputBroadcastStreamProcessFunction<IN1,IN2,OUT>
extends ProcessFunction
This contains all logical related to process records from a broadcast stream and a non-broadcast
stream.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidThis is a life-cycle method indicates that this function will no longer receive any data from the broadcast input.default voidThis is a life-cycle method indicates that this function will no longer receive any data from the non-broadcast input.default voidonProcessingTimer(long timestamp, Collector<OUT> output, PartitionedContext<OUT> ctx) Callback for processing timer.default org.apache.flink.api.common.watermark.WatermarkHandlingResultonWatermarkFromBroadcastInput(org.apache.flink.api.common.watermark.Watermark watermark, Collector<OUT> output, NonPartitionedContext<OUT> ctx) Callback function when receive the watermark from broadcast input.default org.apache.flink.api.common.watermark.WatermarkHandlingResultonWatermarkFromNonBroadcastInput(org.apache.flink.api.common.watermark.Watermark watermark, Collector<OUT> output, NonPartitionedContext<OUT> ctx) Callback function when receive the watermark from non-broadcast input.default voidopen(NonPartitionedContext<OUT> ctx) Initialization method for the function.voidprocessRecordFromBroadcastInput(IN2 record, NonPartitionedContext<OUT> ctx) Process record from broadcast input.voidprocessRecordFromNonBroadcastInput(IN1 record, Collector<OUT> output, PartitionedContext<OUT> ctx) Process record from non-broadcast input and emit data throughCollector.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.
-
processRecordFromNonBroadcastInput
void processRecordFromNonBroadcastInput(IN1 record, Collector<OUT> output, PartitionedContext<OUT> ctx) throws Exception Process record from non-broadcast input and emit data throughCollector.- Parameters:
record- to process.output- to emit processed records.ctx- runtime context in which this function is executed.- Throws:
Exception
-
processRecordFromBroadcastInput
Process record from broadcast input. In general, the broadcast side is not allowed to manipulate state and output data because it corresponds to all partitions instead of a single partition. But you could use broadcast context to process all the partitions at once.- Parameters:
record- to process.ctx- the context in which this function is executed.- Throws:
Exception
-
endNonBroadcastInput
This is a life-cycle method indicates that this function will no longer receive any data from the non-broadcast input.- Parameters:
ctx- the context in which this function is executed.- Throws:
Exception
-
endBroadcastInput
This is a life-cycle method indicates that this function will no longer receive any data from the broadcast input.- Parameters:
ctx- the context in which this function is executed.- Throws:
Exception
-
onProcessingTimer
default void onProcessingTimer(long timestamp, Collector<OUT> output, PartitionedContext<OUT> ctx) throws Exception Callback for processing timer.- Parameters:
timestamp- when this callback is triggered.output- to emit record.ctx- runtime context in which this function is executed.- Throws:
Exception
-
onWatermarkFromBroadcastInput
default org.apache.flink.api.common.watermark.WatermarkHandlingResult onWatermarkFromBroadcastInput(org.apache.flink.api.common.watermark.Watermark watermark, Collector<OUT> output, NonPartitionedContext<OUT> ctx) throws Exception Callback function when receive the watermark from broadcast input.- Parameters:
watermark- to process.output- to emit record.ctx- runtime context in which this function is executed.- Throws:
Exception
-
onWatermarkFromNonBroadcastInput
default org.apache.flink.api.common.watermark.WatermarkHandlingResult onWatermarkFromNonBroadcastInput(org.apache.flink.api.common.watermark.Watermark watermark, Collector<OUT> output, NonPartitionedContext<OUT> ctx) throws Exception Callback function when receive the watermark from non-broadcast input.- Parameters:
watermark- to process.output- to emit record.ctx- runtime context in which this function is executed.- Throws:
Exception
-