How to create Flux from Mono

前端 未结 1 1315
南方客
南方客 2020-12-11 01:59

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

Mono a = ... ;

Flux

        
相关标签:
1条回答
  • 2020-12-11 02:32

    Use Mono.flatMapMany() method:

        Flux flux1 = mono.map(A::getList1).flatMapMany(Flux::fromIterable);
        Flux flux2 = mono.map(A::getList2).flatMapMany(Flux::fromIterable);
    
    0 讨论(0)
提交回复
热议问题