Pull versus push

Finally, to understand the problem described in the previous section, we have to go back in history and analyze the initial interaction model between a source and its subscribers.

During the early period of the whole reactive landscape evolution, all libraries were designed with the thought that data is pushed from the source to the subscriber. That decision was made because a pure pull model is not efficient enough in some cases. An example of this is when communication over the network appeared in the system with network boundaries. Suppose that we filter a huge list of data but take only the first ten elements from it. By embracing the PULL model for solving such a problem, we are left with the following code:

final AsyncDatabaseClient ...

Get Hands-On Reactive Programming in Spring 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.