Say I have 2 Observables (A & B) that are essentially network calls (using Retrofit to give context).
The current flow of the app is as follows:
- A & B are kicked off at about the same time (asynchronously).
- B is executed 0 or more times on user interaction
I have 3 different scenarios that I want to listen for given these 2 observables/api calls.
- I want to know immediately when Observable A completes
- I want to know immediately when Observable B completes
- I want to know when both have completed
First off, is this a good use case for RxJava?
I know how to do each scenario individually (using zip
for the last), though I don't know how to do all of them simultaneously.
If I subscribe to Observable A, A begins. If I subscribe to B, B begins. If A & B complete before I subscribe to zip(a, b), I could miss the event and never actually see this complete, right?
Any general guidance would be appreciated. My RxJava knowledge is pretty thin :P