I have such code:
List<Mono> monoList = foo();
//await when all Monos are finished
try {
Flux.fromIterable(monoList)
.flatMap(Function.identity())
.then()
.block();
} catch (Exception e) {
log.warn("error", e);
}
It works perfect when all MONO are finished successfully but doesn't work if at least onee Mono finished with error. Method block
throw exceptions and interrupts all other monos. So this code awaits when all mono are finished successfully or when the first error happen.
How to await when all Monos from monoList
are finished(doesn't matter succesfully or not)