As we move into a world where we serve millions of users who expect sub-second response times, we need new ways of building applications. This has led to the collection of proven practices under the Reactive Manifesto.
This specifies some core features of resilient apps, capable of scaling up and out:
- Responsive: respond in a timely manner if at all possible
- Resilient: the system is responsive even in the case of failure
- Elastic: the system stays responsive under changes in workload, increasing or decreasing a service’s resources as needed
- Message-driven: the system uses asynchronous message passing between components (including errors), enabling location transparency and loose coupling.
This was the subject of Stephane Maldini’s talk ‘Designing for Distributed Systems with Reactor and Reactive Streams’. Reactive Streams is ‘an initiative to provide a standard for asynchronous stream processing with non-blocking back pressure’. It is key to making sure that fast data sources don’t overwhelm the receiver, so that we at all times have a responsive application (even if that response is “I’m busy now, please call again later”).
There are a few implementations of Reactive Streams, one of them being Spring’s Reactor project. Other implementations include Akka Streams, Ratpack, MongoDB, Slick, RxJava, and Vert.x
Stephane showed an example class which used Akka Streams, Ratpack, Reactor and RxJava in the same stream, to demonstrate the interoperability of the different implementors:
The main feature of Reactive Streams is the concept of ‘back pressure’: that the system pushes back to the sender if its request buffer is full, letting the sender try again later, or with some other receiver. This ensures that the pipeline isn’t flooded, and we have a better chance at getting a responsive system.
The was also a statement that the Spring Integration DSL will have support for Reactive Streams by just using .toReactiveStreamsPublisher() on defined IntegrationFlows, but I can’t find any code in the wild yet.
But if so: thumbsup!
UPDATE: Stephane pointed me to the pull request for SI DSL Reactive support, here: https://github.com/spring-projects/spring-integration-java-dsl/pull/31/files
Thanks!
Also, he will be in Stockholm for a free talk about this subject on at EMC office in Solna, Telegrafgatan 4, on June 17, for anyone else who wants to learn more.