Pivotal's Reactor Goes GA
Pivotal’s aptly named open source reactive programming library, "Reactor," reached a milestone this Tuesday when its 1.0 version was released for General Availability. Reactor provides low-level abstractions for an event-driven, reactive programming model, and is a component member of the Spring IO Platform, in its "IO Foundation" layer.
Reactor is designed as a foundational component of the Spring IO Platform, although, in itself, it has no direct dependency on the Spring Framework. The project’s wiki notes "out-of-the-box support" for Spring with its "reactor-spring" module, however the core API is offered as a self-contained library, and can be leveraged outside of a Spring application context.
Reactor enables developers to build high-throughput, low-latency applications that "must work with thousands, tens of thousands, or even millions of concurrent requests per second." Indeed, the blog post announcing the release touts Reactor as being able to process "10-15 million events per second on a standard developer laptop." The post also make sure to note, however, that "what your application does ... to slow Reactor down can vary depending on the task."
Reactor draws much of its inspiration from the Reactor design pattern, which defines a model for asynchronous event dispatching and handling. The design pattern, however, was not the only source of inspiration for the project, and the release notes cite additional inspiration from many open source projects and libraries, as well from the upcoming Java 8 release. Reactor borrows concepts from those areas to provide abstractions for asynchronous programming techniques like Streams and Promises.
For simplicity in its integration, Reactor offers built-in, first-class support for many popular libraries and languages. As reinforcement to its tagline phrase, "Fast Data", the project makes sure to note its API for the high-throughput LMAX Disruptor, which was designed to "create a very high performance financial exchange."
The project’s "reactor-tcp" module ships with a TCP client and server API that is backed by Netty. Netty is a JVM networking library that provides an "asynchronous event-driven network application framework and tooling ... for high-performance and high-scalability".
Offering syntactic simplification and support for functional programming techniques, Groovy is supported as a first-class language, including the use of Closures as callbacks. Reactor ships with a comprehensive Groovy DSL, which affords a simplified configuration experience. Java 8 is targeted as a first-class language, with Reactor’s API built to leverage lambdas, as well as make use of method references as callbacks. The Clojurewerkz project, Meltdown, provides an interface into Reactor from Clojure. The Reactor team has emphasized that the library's API is "designed to be extensible ... so that non-JVM languages can [also] benefit" from its offerings.
The source code for Reactor is freely available on GitHub and is Apache licensed. Additional quickstart and sample projects are also available to guide newcomers with concrete examples. The Guides section of the newly-redesigned Spring.IO website also offers a comprehensive "Getting Started" tutorial.
Maven artifacts are available for the various Reactor modules, and are available on Maven Central, as noted at the bottom of the release notes.
Srini Penchikala Aug 21, 2014