February 2020
Intermediate to advanced
412 pages
9h 36m
English
The Flowable class is a variant of the Observable that can tell the source to emit at a pace specified by the downstream operations. In other words, it can exert backpressure on the source.
In the following code, replace Observable.range() with Flowable.range(), and this will make this entire chain work with Flowable objects instead of Observable ones. Run the code and you will see a very different behavior with the output:
import io.reactivex.rxjava3.core.Observable;import io.reactivex.rxjava3.schedulers.Schedulers;public class Ch8_03 { public static void main(String[] args) { Flowable.range(1, 999_999_999) .map(MyItem::new) .observeOn(Schedulers.io()) .subscribe(myItem -> { sleep(50); System.out.println("Received ...
Read now
Unlock full access