How can I do ordered merging with RxJava?

I am executing 3 HTTP requests. I want to start everything at the same time, wait for the completion of all, and then merge the three queries, preserving the order of the sequence. Say I have queries r1, r2and r3, and I want to process the results in that order. I tried to do this:

Observable<HttpResponse> r1, r2, r3;
Observable<List<HttpResponse>> merged = Observable.merge(r1, r2, r3).buffer(3);

In this case, there is no guarantee that r3 is index 2 in the returned list. Suggestions?

+4
source share
1 answer

RxJava concatMapEager, . 1.0.15, , Netflix . , .

+3

Source: https://habr.com/ru/post/1613195/


All Articles