Interface CoFlatMapFunction<IN1,IN2,OUT>
-
- Type Parameters:
IN1
- Type of the first input.IN2
- Type of the second input.OUT
- Output type.
- All Superinterfaces:
Function
,Serializable
- All Known Implementing Classes:
RichCoFlatMapFunction
@Public public interface CoFlatMapFunction<IN1,IN2,OUT> extends Function, Serializable
A CoFlatMapFunction implements a flat-map transformation over two connected streams.The same instance of the transformation function is used to transform both of the connected streams. That way, the stream transformations can share state.
An example for the use of connected streams would be to apply rules that change over time onto elements of a stream. One of the connected streams has the rules, the other stream the elements to apply the rules to. The operation on the connected stream maintains the current set of rules in the state. It may receive either a rule update (from the first stream) and update the state, or a data element (from the second stream) and apply the rules in the state to the element. The result of applying the rules would be emitted.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
flatMap1(IN1 value, Collector<OUT> out)
This method is called for each element in the first of the connected streams.void
flatMap2(IN2 value, Collector<OUT> out)
This method is called for each element in the second of the connected streams.
-
-
-
Method Detail
-
flatMap1
void flatMap1(IN1 value, Collector<OUT> out) throws Exception
This method is called for each element in the first of the connected streams.- Parameters:
value
- The stream elementout
- The collector to emit resulting elements to- Throws:
Exception
- The function may throw exceptions which cause the streaming program to fail and go into recovery.
-
flatMap2
void flatMap2(IN2 value, Collector<OUT> out) throws Exception
This method is called for each element in the second of the connected streams.- Parameters:
value
- The stream elementout
- The collector to emit resulting elements to- Throws:
Exception
- The function may throw exceptions which cause the streaming program to fail and go into recovery.
-
-