Reputation: 1389
I have an Observable A and an Observable B. Now I have to wait those Observables finish or at least 30 seconds. How I can achieve this on RxJava?
Thanks for any suggestion!
Upvotes: 2
Views: 1188
Reputation: 12087
You haven't said what you want to do with the emissions of a
and b
apart from wait for completion to finish but you could do this:
Observable.merge(
Observable.timer(30, TimeUnit.SECONDS)
.ignoreElements().cast(Object.class),
a.ignoreElements().cast(Object.class),
b.ignoreElements().cast(Object.class));
Upvotes: 3