I'm new to RxJava. I have a few Jersey RxJava clients that return Observables. I need to make one call to get some data, that data becomes the input to my next 3 calls. I want those calls to be made in parallel. Finally, I want to do a calculation once all the calls have completed that requires all the data. Here is how it looks:
interface Service {
Observable<ResultA> callServiceA(InitialData input);
Observable<ResultB> callServiceB(ResultA resultA);
Observable<ResultC> callServiceC(ResultA resultA);
Observable<ResultD> callServiceD(ResultA resultA);
FinalResult simpleCalculation(ResultA a, ResultB b, ResultC c, ResultD d);
}
class MyClass{
@Autowired
ExecutorService myExecutorService;
Observable<FinalResult> myMethod(InitialData initialData){
/* Make call to ServiceA, get the results, then make calls to services B, C, and D in parallel (on different threads), finally perform simpleCalculation, and emit the result */
}
}