I am using flatMap as an indicator then should I fire another network request.
Observable<ResponseBody> secoondRequest = firstRequest.flatMap(responseBody -> {
return RetrofitFactory.create().setIssuingCountry(countrySetRequest1);
});
The problem is that I have more than one secondRequest Observable, so my firstRequest executes multiple times.. I only need for it to trigger once for all other observables..
//This should not call firstRequest again, if it was already triggered once
Observable<ResponseBody> secoondRequest2 = firstRequest.flatMap(responseBody -> {
return RetrofitFactory.create().setIssuingCountry(countrySetRequest1);
});
It is not entirely clear what your usecase is. So I am assuming that you have multiple requests that depend on the response of the first request. That is
request1 <- request2, request3, request4.... One possible way to solve problem is as below