Observable

The Observable class is similar to Flowable, but it can throw a MissingBackpressureException.

Backpressure is a case when an observable produces values faster than a subscriber can consume them. In this case, a MissingBackpressureException is thrown.

An example use case is as follows:

Observable.fromIterable(listOf(1, 2, 3))
.subscribe { println(it) }

The preceding snippet shows how to create an instance of the Observable class that emits values.

It is worth mentioning that Observable has lower overhead than Flowable. You should consider using Observable when you handle user interface events.

There are operators that can help you to deal with backpressure, such as debounce or throttle. Let's take a look at each one of them.