The Subscriber

Instead of an Observer, the Flowable uses a Subscriber to consume emissions and events at the end of a Flowable chain. If you pass only lambda event arguments (and not an entire Subscriber object), subscribe() does not return a Disposable but rather a Subscription, which can be disposed of by calling cancel() instead of dispose(). The Subscription can also serve another purpose; it communicates upstream how many items are wanted using its request() method. Subscription can also be leveraged in the onSubscribe() method of Subscriber to request() elements the moment it is ready to receive emissions.

Just like an Observer, the quickest way to create a Subscriber is to pass lambda arguments to subscribe(), as we have been doing ...

Get Learning RxJava now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.