I'm converting small project written in RxJava 1.x to Reactor 3.x. All is good, except that I could not find out how to replace flatMap(Observable::from) with an appropriate counterpart. I have Mono<List<String>> and I need to convert it to Flux<String>.
35
votes
3 Answers
76
votes
8
votes
I think that probably Flux::mergeSequential static factory fits better here:
Iterable<Mono<String>> monos = ...
Flux<String> f = Flux.mergeSequential(monos);
This kind of merge (sequential) will maintain the ordering inside given source iterable, and will also subscribe/request eagerly from all participating sources (so more parallelization expected while computing mono results).