June 2017
Intermediate to advanced
400 pages
8h 44m
English
There is another way that you can implement BackpressureStrategy against a source that has no notion of backpressure. You can turn an Observable into Flowable easily 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. The Observable has no notion of backpressure, so it is going to push items as quickly as it can regardless if 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.BackpressureStrategy; import io.reactivex.Observable; ...
Read now
Unlock full access