February 2020
Intermediate to advanced
412 pages
9h 36m
English
There is another way to implement BackpressureStrategy against a source that has no notion of backpressure. You can turn an Observable into Flowable by calling its toFlowable() operator, which accepts a BackpressureStrategy as an argument. In the following code, we turn Observable.range() into Flowable using BackpressureStrategy.BUFFER. An Observable has no notion of backpressure, so it is going to push items as quickly as it can, regardless of whether the downstream can keep up. But toFlowable(), with a buffering strategy, will act as a proxy to backlog the emissions when the downstream cannot keep up:
import io.reactivex.rxjava3.core.BackpressureStrategy;import io.reactivex.rxjava3.core.Observable; ...
Read now
Unlock full access