IN1
- Type of the first input.IN2
- Type of the second input.OUT
- Output type.@Public public interface CoFlatMapFunction<IN1,IN2,OUT> extends Function, Serializable
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.
Modifier and Type | Method and 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.
|
void flatMap1(IN1 value, Collector<OUT> out) throws Exception
value
- The stream elementout
- The collector to emit resulting elements toException
- The function may throw exceptions which cause the streaming program to fail
and go into recovery.void flatMap2(IN2 value, Collector<OUT> out) throws Exception
value
- The stream elementout
- The collector to emit resulting elements toException
- The function may throw exceptions which cause the streaming program to fail
and go into recovery.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.