I am making two API calls in the following way. If any of the two API calls fail, I would want to retry that API by changing certain params. How to achieve this?
Single.zip(API1.subscribeOn(Schedulers.io()),
API2.subscribeOn(Schedulers.io()), Bifunction())).subscribe();
U can use onErrorResumeNext to handle ur scenario here. For both the API calls add a onErrorResumeBlock which could be retrying the same api with diff params. Like:
Single.zip(API1.subscribeOn(Schedulers.io())
.onErrorResumeNext { throwable:Throwable ->
return@onErrorResumeNext API1DIFF_PARAMS },
API2.subscribeOn(Schedulers.io())
.onErrorResumeNext { throwable:Throwable ->
return@onErrorResumeNext API2DIFF_PARAMS }, Bifunction())).subscribe();
Downside is this will work only once. If your second API also fails then it will land in the error block of ur subscribe method