I am making 10 independent network calls each returning a Mono of a different kind. These calls can run in parallel. After all of them finish, I want to compute something based on the results.
Mono.zip(
mono1(),
mono2(),
mono3(),
...
mono8()
)
Mono.zip allows me to compose a maximum of 8 Monos. I can do a workaround by using zip multiple times, but that isn't a clean way.
Mono.zip(
mono1(),
mono2(),
mono3(),
...
mono8()
).zipWith(mono9())
Overloads of zip that take array or iterable of Monos along with a combinator function give me Array<*> where I lose all my individual Mono types.
Are there any better ways to compose these many Monos ?
zip
? it seems thatreduce
works better to compute based on the results. – Igor Artamonov