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:
Flow.Publisherinterface, to implement the publishers of information
Flow.Subscriberinterface, to implement the subscribers (consumers) of that information
Flow.Subscriptioninterface, 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 the two implementation variants you can use with reactive streams in Java. We have implemented an event notification system implementing...