Combining a stream with a fixed substream

(Ghislain Antony Vaillant) #1

I have got a pipeline which, after a decoding step, produces a stream with the following structure:

| PixelData | MetaData |

PixelData will then be processed by a separate Flow which will produce a stream of NewPixelData eventually. These NewPixelData then need to be re-encoded using the MetaData.

| NewPixelData_2 | NewPixelData_1 | MetaData |

to produce:

| EncodedData_2 | EncodedData_1 |

Which topology and / or stream combinators can I use to achieve this?

EDIT: Fix typo reported by @bentito

(Brett Tofel) #2

I don’t think stream contaminators is a thing. You might want to check that and restate the question.

(Ghislain Antony Vaillant) #3


My bad.

(Johan Andrén) #4

Look at flatMapConcat it will map an element to a stream and then consume that stream until it completes before doing the same with the next element. And then perhaps statefulMapConcat in the end for the re-encoding