Reactive Streams is an initiative to provide a standard for asynchronous stream processing with non-blocking back pressure. This encompasses efforts aimed at runtime environments (JVM and JavaScript) as well as network protocols.
The project is a collaboration between engineers from Kaazing, Netflix, Pivotal, RedHat, Twitter, Typesafe and many others and is developed and discussed in the open.
The core idea behind the Reactive Stream standard is in the definition of two different channels for the downstream data and the upstream demand.
This allows to overcome one of the biggest issue of the Rx approaches: backpressure. Backpressure is a lack of demand, and is due to the fact that the producer of a stream of items is faster than the consumer, and that difference of speed quickly determines a growing backlog of unconsumed items on the consumer side.
In the literature (and in our everyday life) there's already a protocol that solved a similar problem: TCP. With this in mind, engineers behind Reactive Streams proposed a solution that, in simple terms, works like this:
Engineers called this technique dynamic push/pull. The dynamic terms indicates that the system should adapt to the current conditions of its components and that's not safe to only use a just push or just pull approach.
A just push approach is not safe when the subscriber is slow, since it'll quickly start to be overwhelmed by the offers and will start to:
A just pull approach is too slow in the case that the subscriber is faster than the pubblisher.
Two important notes about the fact that data and demand flows in different channels and directions are the following:
As the main document says, the scope of Reactive Streams is to find a minimal set of interfaces, methods and protocols that will describe the necessary operations and entities to achieve the goal—asynchronous streams of data with non-blocking back pressure. This set of interfaces are a low level specification to which each library should be conform to.
The API offers the following interfaces that are required to be implemented by each implementations: