Reactive Streams (RS) is an initiative to provide a standard for asynchronous stream processing with non-blocking backpressure. At its core it defines a protocol for moving streaming data across an asynchronous boundary (e.g. between threads or machines) in a way that allows both sides to run independently, in their own time and space, within bounded memory (no unlimited buffering) and without any blocking.
Like many other protocols this RS protocol is not something that developers of higher-level applications typically implement themselves. (HTTP, for example, is another protocol that you don’t want to implement yourself only to be able to use it.) Rather one normally relies on a specific implementation (e.g. in the form of a library) which provides higher-level interfaces idiomatic to the respective (language) environment.
swave is such an implementation of the RS protocol for Scala.
One output of the Reactive Streams initiative is a set of Java interfaces that are provided to the public as a Java library under the Creative Commons Zero Public Domain license (group-id
reactive-streams). The interface types defined in this library, most importantly org.reactivestreams.Publisher and org.reactivestreams.Subscriber, are implemented by RS-compatible libraries and thus allow for seamless integration between different RS-implementations on the JVM.
Normally you shouldn’t have to define the
reactive-streams JAR as an explicit dependency of your project. It’ll automatically land on your classpath as a transitive dependency of swave (or Akka-Stream, for example).
swave allows you to interface with other RS-implementations in any way you want.
- Provide and consume RS Publishers
- Provide and feed into RS Subscribers
- Provide and use RS Processors