Interface Subscriber
Instead of an Observer, 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 an org.reactivestreams.Subscription, which can be disposed of by calling cancel() instead of dispose(). 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, which can call the request() method (and pass in the number of the requested elements) the moment it is ready to receive emissions.
Just like an Observer, the quickest way to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access