Among many other features, Java 9 introduced these four interfaces in the java.util.concurrent.Flow class:
Flow.Publisher<T> - producer of items (messages) of type TFlow.Subscriber<T> - receiver of messages of type TFlow.Subscription - links producer and receiverFlow.Processor<T,R> - acts as both producer and receiver
With this, Java stepped into the world of reactive programming--programming with the asynchronous processing of data streams.
We discussed streams in Chapter 3, Modular Programming and pointed out that they are not data structures, as they do not keep data in memory. The stream pipeline does nothing until an element is emitted. Such a model allows minimal resource allocation and uses resources only as needed. The ...