Ill preface this by saying I am new at WebFlux and reactive programming in general and I am trying to get up to speed on the best patterns and practices.
But I am looking for a way to make many parallel api calls only after I successfully make another seperate API call.
Something like this
Mono<someReturnObject> saveStateOfMultipleObjectsinTheDB(SO request){
Mono<String> 1stCallResult = saveFirstObject(request.getFirstObject());
Mono.zip(saveSecondObject(request.getSecondObject().subscribeOn(Schedulers.elastic()), saveThirdObject(request.getThirdObject().subscribeOn(Schedulers.elastic())).map(this::maptoSomeReturnObject())
}
Now that is a slight simplification. Ideally I would like to write a lambda function in each of those zip methods, but if I have to I will write up a function just like described here. But is my thinking right with this pattern?