-
Notifications
You must be signed in to change notification settings - Fork 137
Document the new Completable Observable-like variant #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
See also: ReactiveX/RxJava#3444 (Completable) |
See also: ReactiveX/RxJava#3567 (toCompletable / Completable.fromObservable) |
See also: ReactiveX/RxJava#3568 (Completable.doAfterTerminate) |
See also:
|
See also: ReactiveX/RxJava#3580 (Completable review) |
See also: ReactiveX/RxJava#3701 (change name of doOnComplete to doOnCompleted) |
See also: ReactiveX/RxJava#3706 (lifecycle of Singles and Completables compared to Observables) |
From the RxJava 1.1.1 release notes: What is this Completable class? We can think of a Completable object as a stripped version of Observable where only the terminal events, onError and onCompleted are ever emitted; they may look like an Observable.empty() typified in a concrete class but unlike empty(), Completable is an active class. Completable mandates side effects when subscribed to and it is its main purpose indeed. Completable contains some deferred computation with side effects and only notifies about the success or failure of such computation. Similar to Single, the Completable behavior can be emulated with Observable<?> to some extent, but many API designers think codifying the valuelessness in a separate type is more expressive than messing with wildcards (and usually type-variance problems) in an Observable chain. Completable doesn't stream a single value, therefore, it doesn't need backpressure, simplifying the internal structure from one perspective, however, optimizing these internals requires more lock-free atomics knowledge in some respect. Hello World! Let's see how one can build a (side-effecting) Hello World Completable:
Quite straightforward. We have a set of fromXXX method which can take many sources: Action, Callable, Single and even Observable (stripping any values generated by the latter 3 of course). On the receiving end, we have the usual subscribe capabilities: empty, lambdas for the terminal events, a rx.Subscriber and a rx.Completable.CompletableSubscriber, the main intended receiver for Completables. Further reading
|
See also: ReactiveX/RxJava#3730 (Completable.andThen) |
See also: ReactiveX/RxKotlin#48 |
It's still being discussed, but it seems like they're leaning toward adding this operator under some name or other to 1.x. See ReactiveX/RxJava#3443
The text was updated successfully, but these errors were encountered: