I playing around with r2dc for spring boot java application.
I was thinking if possible to convert a Flux to Mono for certain calculation.
Pseudo example:
static PseudoMagic calculate(List<Foo> foos) {
return callTheMagicRutine(foos)
}
Mono<PseudoMagic> getMyMagic() {
Flux<Foo> foos = getMyFoos()
foos.transformToMagic(f -> calculator(f))
}
You need to use collectList() method in Flux
to transform the Flux<Foo>
to Mono<List<Foo>>
. That is the best you can do.