In this chapter, you have learnt how Java 9 implements the reactive streams specification. It defines a standard for asynchronous stream processing with non-blocking back pressure. It's based on the following three elements:
- A publisher of information
- One or more subscribers of that information
- A subscription between the publisher and a consumer
Java provides three interfaces to implement those elements:
- The Flow.Publisher interface, to implement the publishers of information
- The Flow.Subscriber interface, to implement the subscribers (consumers) of that information
- The Flow.Subscription interface, to implement the subscription between publishers and subscribers
Java also provides a utility class, the SubmissionPublisher class that implements the Publisher interface and can be used if our application has default behavior.
We have implemented two examples with...