Java Magazine, Jan/Feb 2018
ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2018 63 reactive programming A Publisher that is also a Subscriber is called a Processor which is shown in Listing 4 Listing 4 The Reactive Streams Processor package org reactivestreams public interface Processor T R extends Subscriber T Publisher R The specification is not meant to be a prescription for the implementations instead it defines types for interoperability The Reactive Streams types eventually found their way into Java 9 as one to one semantically equivalent interfaces in the java util concurrent Flow class Reactor The Reactive Streams types are not enough youll need higher order implementations to support operators such as filtering and transformation Pivotals Reactor project is a good choice here it builds on top of the Reactive Streams specification It provides two specializations of Publisher T The first Flux is a Publisher that produces zero or more values Its unbounded The second Mono T is a Publisher that produces one or zero values Theyre both publishers and you can treat them that way but they go much further than the Reactive Streams specification They both provide ways to process a stream of values Reactor types compose nicely the output of one thing can be the input to another Reactive Spring As useful as project Reactor is its only a foundation Applications need to talk to data sources They need to produce and consume HTTP Server Sent Events SSE or WebSocket endpoints They support authentication and authorization Spring Framework 50 provides these things It was released in September 2017 and builds on Reactor and the Reactive Streams specification It includes a new reactive runtime and component model called Spring WebFlux Spring WebFlux does not depend on or require the Servlet APIs to work It ships with adapters that allow it to
You must have JavaScript enabled to view digital editions.