I have a Mono that I want to combine with another Mono, as in:
val firstMono = Mono.just("thing");
val secondMono = Mono.just("other thing");
val thirdMono = firstMono.zipWith(secondMono, function);
But I want the function to also return a Mono, without ending up with a Mono<Mono<?>>
The best I can come up with is:
val thirdMono = firstMono.zipWith(secondMono, function)
.flatMap(identity());
but that seems like a bit of a hack.
I also thought of
val thirdMono = firstMono.zipWith(secondMono)
.flatMap(function);
but in that case, I have to have the function accept a Tuple2 instead of the individual arguments, which is uglier.
Any thoughts?