2

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))
}
Dasma
  • 1,023
  • 13
  • 34

1 Answers1

5

You need to use collectList() method in Flux to transform the Flux<Foo> to Mono<List<Foo>>. That is the best you can do.

João Dias
  • 16,277
  • 6
  • 33
  • 45