I'm trying to make parallel rest api calls to 5 different backend systems. Each rest api has different endpoints and different response types. I tried to accomplish this by using Webclient. I'm not able to figure out how to "block" the Mono's emitted by each api call at the same time.
Here is my sample code.
Mono<ClientResponse> userDetails = getUserDetails().subscribeOn(Schedulers.parallel());
Mono<ClientResponse> userAccountDetails = getUserAccountDetails().subscribeOn(Schedulers.parallel());
//getUserDetails and getUserAccountDetails does an exchange() and not retrieve() as i need access to the headers.
Tuple2<ClientResponse, ClientResponse> tuple = Mono.zip(userDetails, userAccountDetails).block();
tuple.getT1().bodyToMono(String.class).block()
tuple.getT2().bodyToMono(String.class).block()
The problem with this approach is even if I zipped the ClientResponses, I still have to invoke a block for each item.