Rxjava: 2.x Completable stops the chain

Created on 2 May 2017  路  2Comments  路  Source: ReactiveX/RxJava

I discovered that once Completable is done (method of CompletableEmitter.onComplete() is called), the chain stops and all operators are not called.

So I have the following source code

Completable setup() {
...
}
....
            payment.setup()
                          .toObservable()
                          .flatMap(new Function<Object, ObservableSource<List<String>>() {
                                       @Override
                                       public ObservableSource<String>> apply(@io.reactivex.annotations.NonNull Object o) throws Exception {
                                           return "Some mapping is here";
                                       }
                                   });

Once setup() method finished successfully, flatMap() is not called. Is it supposed to be so? Is it possible to have a chain to Completable?

2.x Question

Most helpful comment

Completable does not have values and flatMap doesn't work without values. Use Completable.andThen.

All 2 comments

Completable does not have values and flatMap doesn't work without values. Use Completable.andThen.

Perfect. Thanks!

Was this page helpful?
0 / 5 - 0 ratings