How to convert List<Mono<String>> into Flux<List<String>>?

断了今生、忘了曾经 提交于 2019-12-25 01:12:23

问题


List<Mono<String>> responses = apiCall()

I would like to get Flux<String> to await all mono-s from list.

How could I achieve it ?

P.S.

I've found similar question but I need vice versa operation https://stackoverflow.com/a/44040346/2674303


回答1:


You could use Flux.mergeSequential() and Flux.collectList()

Mono<List<String>> list = Flux.mergeSequential(apiCall()).collectList();


来源:https://stackoverflow.com/questions/58913554/how-to-convert-listmonostring-into-fluxliststring

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!