onBackpressureLatest
onBackpressureLatest is an operator in RxJava’s Flowable lineage that implements a specific backpressure strategy focused on delivering only the most recent value when the downstream consumer is slow. It is used to convert a high-frequency upstream into a stream that prioritizes the latest emission, discarding older ones as needed to keep memory usage bounded.
When upstream emits values faster than the downstream can process, onBackpressureLatest buffers at most a single
This operator is suitable for streams where only the latest state matters, such as real-time UI updates,
Relation to other backpressure strategies
onBackpressureLatest contrasts with strategies like onBackpressureBuffer (which stores all items), onBackpressureDrop (drops new items when full),
onBackpressureLatest is provided on Flowable and is part of RxJava’s backpressure toolkit, alongside other strategies such