These are chat archives for ReactiveX/RxJava

12th
Sep 2017
Ilya Krol
@ilya_krol_twitter
Sep 12 2017 05:39

@Exerosis thanks for the response, but this has the same effect, assuming that the outcome of the flatMap is a Completable and I use andThen instead of doOnNext. I could make it doOnNext (doOnComplete actually as the result is a Completable), and this is how i currently solved this, but the updateInteractor is a Completable also, so this breaks the stream somewhat as I subscribe to this different stream in the side effect operator. It works but it looks ugly and I wonder if there is a better option which keeps me within the same stream for all operations. as a clarification this is how my code looks right now (roughly):

someValue
    .toSingle()
    .flatMapCompletable { possiblyExceptionCompletable }
    .doOnComplete { updateInteractor(success).subscribeOn(Schedulers.io()).subscribe() }
    .doOnError { updateInteractor(failure).subscribeOn(Schedulers.io()).subscribe() }

I want to get rid of the two subscriptions mid-stream.