How to create Flux from Mono

I have Mono A. Object A contains two lists. I want to create a straight two threads. Is this possible without block ()?

Mono<A> a = ... ;

Flux<AList1> a1 =  Flux.fromIterable(a.block().getList1());
+4
source share
1 answer

Use the Mono.flatMapMany () method:

    Flux flux1 = mono.map(A::getList1).flatMapMany(Flux::fromIterable);
    Flux flux2 = mono.map(A::getList2).flatMapMany(Flux::fromIterable);
+2
source

Source: https://habr.com/ru/post/1694675/


All Articles