June 2017
Intermediate to advanced
400 pages
8h 44m
English
The onBackPressureBuffer()will take an existing Flowable that is assumed to not have backpressure implemented and then essentially apply BackpressureStrategy.BUFFER at that point to the downstream. Since Flowable.interval() cannot be backpressured at the source, putting onBackPressureBuffer() after it will proxy a backpressured queue to the downstream:
import io.reactivex.Flowable; import io.reactivex.schedulers.Schedulers; import java.util.concurrent.TimeUnit;public class Launcher { public static void main(String[] args) { Flowable.interval(1, TimeUnit.MILLISECONDS) .onBackpressureBuffer() .observeOn(Schedulers.io()) .subscribe(i -> { sleep(5); System.out.println(i); }); sleep(5000); } public static void sleep(long ...Read now
Unlock full access