RxJava parallel emit once
up vote
0
down vote
favorite
i try to get an array of flowable get executed in parallel with FlowableFromArray
and emit the FlowableFromArray when all flowables are done.
But I'm missing the method to emit on last/latest.
I could only manage to make it work to emit onNext @see below
val results = FlowableFromArray(flowableArray).parallel()
.runOn(Schedulers.io())
.sequential()
.zipWith(r, BiFunction { t1: Flowable<String>, t2: Int
->
t1
.subscribeOn(Schedulers.io())
.map { i -> parseYoutubeTrack(i) }
.observeOn(AndroidSchedulers.mainThread())
.subscribe { next -> TLog.i(TAG, "_NEXT_ ${next.videoId}") }
})
.subscribe()
android rx-java rx-java2
add a comment |
up vote
0
down vote
favorite
i try to get an array of flowable get executed in parallel with FlowableFromArray
and emit the FlowableFromArray when all flowables are done.
But I'm missing the method to emit on last/latest.
I could only manage to make it work to emit onNext @see below
val results = FlowableFromArray(flowableArray).parallel()
.runOn(Schedulers.io())
.sequential()
.zipWith(r, BiFunction { t1: Flowable<String>, t2: Int
->
t1
.subscribeOn(Schedulers.io())
.map { i -> parseYoutubeTrack(i) }
.observeOn(AndroidSchedulers.mainThread())
.subscribe { next -> TLog.i(TAG, "_NEXT_ ${next.videoId}") }
})
.subscribe()
android rx-java rx-java2
This makes no sense; you go parallel to then go back to sequential, then you subscribe in the zip handler. And also what isr
?
– akarnokd
Nov 11 at 10:32
Made it work like so return FlowableFromArray(flowableArray) .parallel() .runOn(Schedulers.computation()) .map { f -> parseYoutubeTrack(f.blockingFirst()) } .sequential() .blockingLatest().toMutableList()
– Plagueis
Nov 18 at 17:05
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
i try to get an array of flowable get executed in parallel with FlowableFromArray
and emit the FlowableFromArray when all flowables are done.
But I'm missing the method to emit on last/latest.
I could only manage to make it work to emit onNext @see below
val results = FlowableFromArray(flowableArray).parallel()
.runOn(Schedulers.io())
.sequential()
.zipWith(r, BiFunction { t1: Flowable<String>, t2: Int
->
t1
.subscribeOn(Schedulers.io())
.map { i -> parseYoutubeTrack(i) }
.observeOn(AndroidSchedulers.mainThread())
.subscribe { next -> TLog.i(TAG, "_NEXT_ ${next.videoId}") }
})
.subscribe()
android rx-java rx-java2
i try to get an array of flowable get executed in parallel with FlowableFromArray
and emit the FlowableFromArray when all flowables are done.
But I'm missing the method to emit on last/latest.
I could only manage to make it work to emit onNext @see below
val results = FlowableFromArray(flowableArray).parallel()
.runOn(Schedulers.io())
.sequential()
.zipWith(r, BiFunction { t1: Flowable<String>, t2: Int
->
t1
.subscribeOn(Schedulers.io())
.map { i -> parseYoutubeTrack(i) }
.observeOn(AndroidSchedulers.mainThread())
.subscribe { next -> TLog.i(TAG, "_NEXT_ ${next.videoId}") }
})
.subscribe()
android rx-java rx-java2
android rx-java rx-java2
asked Nov 10 at 21:07
Plagueis
63
63
This makes no sense; you go parallel to then go back to sequential, then you subscribe in the zip handler. And also what isr
?
– akarnokd
Nov 11 at 10:32
Made it work like so return FlowableFromArray(flowableArray) .parallel() .runOn(Schedulers.computation()) .map { f -> parseYoutubeTrack(f.blockingFirst()) } .sequential() .blockingLatest().toMutableList()
– Plagueis
Nov 18 at 17:05
add a comment |
This makes no sense; you go parallel to then go back to sequential, then you subscribe in the zip handler. And also what isr
?
– akarnokd
Nov 11 at 10:32
Made it work like so return FlowableFromArray(flowableArray) .parallel() .runOn(Schedulers.computation()) .map { f -> parseYoutubeTrack(f.blockingFirst()) } .sequential() .blockingLatest().toMutableList()
– Plagueis
Nov 18 at 17:05
This makes no sense; you go parallel to then go back to sequential, then you subscribe in the zip handler. And also what is
r
?– akarnokd
Nov 11 at 10:32
This makes no sense; you go parallel to then go back to sequential, then you subscribe in the zip handler. And also what is
r
?– akarnokd
Nov 11 at 10:32
Made it work like so return FlowableFromArray(flowableArray) .parallel() .runOn(Schedulers.computation()) .map { f -> parseYoutubeTrack(f.blockingFirst()) } .sequential() .blockingLatest().toMutableList()
– Plagueis
Nov 18 at 17:05
Made it work like so return FlowableFromArray(flowableArray) .parallel() .runOn(Schedulers.computation()) .map { f -> parseYoutubeTrack(f.blockingFirst()) } .sequential() .blockingLatest().toMutableList()
– Plagueis
Nov 18 at 17:05
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243415%2frxjava-parallel-emit-once%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This makes no sense; you go parallel to then go back to sequential, then you subscribe in the zip handler. And also what is
r
?– akarnokd
Nov 11 at 10:32
Made it work like so return FlowableFromArray(flowableArray) .parallel() .runOn(Schedulers.computation()) .map { f -> parseYoutubeTrack(f.blockingFirst()) } .sequential() .blockingLatest().toMutableList()
– Plagueis
Nov 18 at 17:05