BackpressureStrategy.MISSING and onBackpressureXXX()
BackpressureStrategy.MISSING
implies that it'll not implement any backpressure strategy, so you need to explicitly tell Flowable
which backpressure strategy to follow. The onBackpressureXXX()
operators help you achieve the same, while providing you with some additional configuration options.
There are mainly three types of onBackpressureXXX()
operators available:
onBackpressureBuffer()
onBackpressureDrop()
onBackpressureLatest()
Operator onBackpressureBuffer()
This operator serves the purpose of BackpressureStrategy.BUFFER
; except that here, you'll get some extra configuration options, such as buffer size, bounded or unbounded, and more. You may omit the configurations as well to use the default behavior.
So, let's look at some examples:
fun main(args: Array<String>) { val source = Observable.range(1, 1000) source.toFlowable(BackpressureStrategy.MISSING)//(1) .onBackpressureBuffer()//(2) .map { MyItem11...