Cross-posting this here and will link the answer.
Let’s say we have a graph that looks like this:
broadcast ~> flowA ~> fanIn source ~> broadcast ~> flowB ~> fanIn ~> sink broadcast ~> flowC ~> fanIn
flowC all perform a transformation on the incoming elements.
fanIn performs some combining action on the results of all three flows.
The challenge is that Flows
C do not emit elements at the same rate. For some elements of the source,
flowA has nothing to emit, while
C continue emitting.
fanIn I want to be sure that the received elements on all three ports “belong” to the same element emitted from the source, i.e. that they are result of the transformations of the same element.
How would one go about this?
My current solution is to have Flows
Options. Each flow emits a
Some if it can perform a transformation, and a
None if it cannot. This way the number of emitted elements and rate on all three flows remains the same, and I can guarantee that received elements belong to the same source element. I’m looking for a more better performing solution that, if possible, does not require unnecessary object creation and wrapping.