Chapter 4. Introduction to Backpressure and Flowables
So far, we were trying to understand the push-based architecture of reactive programming. By now, we have gained a good understanding of Observables
. We now understand that an Observable
emits items to be consumed by an Observer
for further processing. However, while going through previous chapters, did you ever think of a situation where the Observable
emits items faster than the Observer
can consume them? This whole chapter is devoted to this problem. We will start by trying to understand how and when this problem may occur, and then we will try to solve the problem.
So, in this chapter, we will focus on the following topics, and by the end of the chapter we should have a solution to the problem mentioned earlier:
- Understanding backpressure
- Flowables and Subscriber
- Creating Flowables with
Flowable.create()
- Using Observable and Flowables together
- Backpressure operators
- An
Flowable.generate()
operator
So, now, let's start with backpressure—the...