subscribe

Subscribes the given observer to receive updates, including an Observer.onComplete notification when the upstream source terminates. The subscription is stored in the given composite

Upon the Observer.onComplete signal, the observer is removed from the given composite

Note. adding to the composite happens on the caller thread, and removals may happen on a different one. As such, users should be certain that either composite is thread-safe, or that the caller and disposal thread are the same.

Return

A Disposable for cancelling the subscription.

Parameters

observer

The observer to receive values and the completion signal.


Subscribes the given onNext to receive updates. The subscription is stored in the given composite

Upon the Observer.onComplete signal, the onNext is removed from the given composite

Note. adding to the composite happens on the caller thread, and removals may happen on a different one. As such, users should be certain that either composite is thread-safe, or that the caller and disposal thread are the same.

Return

A Disposable for cancelling the subscription.

Parameters

onNext

The Consumer to receive emitted values.


fun <T> Observable<T>.subscribe(composite: CompositeDisposable, onNext: Consumer<T>, onComplete: Runnable): Disposable

Subscribes the given onNext to receive updates and the given onComplete to receive the Observer.onComplete signal. The subscription is stored in the given composite

Upon the Observer.onComplete signal, the onNext is removed from the given composite

Note. adding to the composite happens on the caller thread, and removals may happen on a different one. As such, users should be certain that either composite is thread-safe, or that the caller and disposal thread are the same.

Return

A Disposable for cancelling the subscription.

Parameters

onNext

The Consumer to receive emitted values.

onComplete

The block of code to run upon completion