I would like to know how to make several parallel calls to REST or Web services, then join the responses and send it in the response of a call @RestController.
Something similar to the following code built with ComparableFuture, but with Reactor(Flux, Mono).
CompletableFuture<Company> companyCompletableFuture = CompletableFuture.supplyAsync(() -> {
return Company.find.where().eq("id", id).findUnique();
});
CompletableFuture<List<Domain>> domainsCompletableFuture = CompletableFuture.supplyAsync(() -> {
return Domain.find.where().eq("company_id", id).findList();
});
// wait for all the data
CompletableFuture allDoneFuture = CompletableFuture.allOf(companyCompletableFuture, domainsCompletableFuture);
allDoneFuture.get(); // wait for all done
company = companyCompletableFuture.get();
domain = domainsCompletableFuture.get()