Reactive Programming with Reactor 3



Merging sequences is the operation consisting of listening for values from several Publishers and emitting them in a single Flux.

On this first exercise we will begin by merging elements of two Flux as soon as they arrive. The caveat here is that values from flux1 arrive with a delay, so in the resulting Flux we start seeing values from flux2 first.

Simple Merge

But if we want to keep the order of sources, we can use the concat operator. Concat will wait for flux1 to complete before it can subscribe to flux2, ensuring that all the values from flux1 have been emitted, thus preserving an order corresponding to the source.

Keep the order

You can use concat with several Publisher. For example, you can get two Mono and turn them into a same-order Flux:

Create a flux from two mono
Create your playground on
This playground was created on, our hands-on, knowledge-sharing platform for developers.
Go to