These are chat archives for ReactiveX/RxJava

14th
Oct 2017
Amir Mahmoud
@amebrahimi
Oct 14 2017 10:38
Hello Guys, does any one know a good course for learning RxJava and RxAndroid?
Dmitriy Manzhosov
@manzhda
Oct 14 2017 10:38
+1
Gundelino85
@Gundelino85
Oct 14 2017 11:23
hi guys! :)
I tried many hours now :worried: , maybe someone can help me. I have to get x files from a server, but only want to download 4 at the same time. These downloads are observables. And when i downloaded all of them (no difference if they fail or not) i get the message, that the download is complete. i found zip and flatMapWithMaxConcurrent but i dont know how to use them with each other. Maybe other methods are even better. I hope someone can help me :)
Dorus
@Dorus
Oct 14 2017 11:32
@Gundelino85 flatMap has overloads with the maxConcurrency parameter. Just set that to 4 and use the flatMap as normal.
Gundelino85
@Gundelino85
Oct 14 2017 11:33
you again :D
ok, let me explain what i have. I use retrofit and get a list with UUIDs in the first request. In that subscription i want to do what i wrote above. But i can not get this "complete state" after everything is finished
*in the first request i get the list of IDs for the PDFs i want to download...
Dorus
@Dorus
Oct 14 2017 14:03
@Gundelino85 yeah, but my RxJava knowledge is a bit more limited. However the answer i gave in the other chat should still apply. You could do something like:
initialRequest()
  .flatMap(arr -> Observable.from(arr)
    .flatMap(id -> otherRequest(id), bool, 4)
  )
Gundelino85
@Gundelino85
Oct 14 2017 14:04
but then i subscribe on each request and not on the package, or am i wrong?