I have three Mono of json strings as below
Mono<String> strInventoryResp=invWebClient.get().
uri("/findATSInventory?skuId="+skuId).
exchange().flatMap(resp-> resp.bodyToMono(String.class));
Mono<String> strProductResponse=productClient.get().
uri("/v2/products/id/"+skuId).
exchange().flatMap(resp-> resp.bodyToMono(String.class));
Mono<String> strItemResp=productClient.get().
uri("/v2/items?id="+skuId).
exchange().flatMap(resp-> resp.bodyToMono(String.class));
I want to merge it into a Flux of Json string such that the result is also a json string.
I have tried the Flux.merge static method but, obviously it does not return in json format as shown below
Flux.merge(strProductResponse,strItemResp,strInventoryResp);
How do I return a Flux of combined mono responses such that a valid stream of JSON string is returned in the browser when I invoke the controller calling this method?
EDIT: My problem statement is to invoke those three APIs asynchronously using web flux and combine the result into one. The controller will call this method and return the combined results for a UI. Is there an alternate approach to this?