How to convert Mono<List<String>> into Flux<String>
In Reactor 3, the from
operator has been specialized into a few variants, depending on the original source (array, iterable, etc...).
Use yourMono.flatMapMany(Flux::fromIterable)
in your case.
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).
Thanks Simon, I implemented something like this:
List<Object> dbObjects = ListObjectsBD();
List<Dao> daos = mapperObjToDao(dbObjects);
Flux<Dao> daoFlux = Mono.just(daos).flatMapMany(Flux::fromIterable);