Subscriber

Learn how a consumer can notify a producer using a Subscriber.

We'll cover the following

Use a Subscriber to allow fine-grained control of how a consumer notifies a producer that it can consume more data. In addition to the standard observer methods .onNext(T), .onError(Throwable), and .onComplete(), a Subscriber has an additional method, .onSubscribe(Subscription), which is called upon subscribing to a producer ( Flowable). The Subscription object received from .onSubscribe(Subscription) is then used to control the flow of production from the producer through its method .request(long). As soon as .onSubscribe() is invoked, we must immediately request data from the producer via .request(long) to begin receiving items.

Get hands-on with 1400+ tech skills courses.