Documentation

You are viewing the documentation for the 2.4.0-M2 development release. The latest stable release series is 3.0.x.

§Reactive Streams integration (experimental)

Play experimental libraries are not ready for production use. APIs may change. Features may not work properly.

Reactive Streams is a specification and SPI that is currently under development. Reactive Streams provides a common standard that allows different stream implementations to be connected together. The SPI is quite small, with just a few simple interfaces such as Publisher and Subscriber.

Play 2.4 provides an experimental Reactive Streams integration module that adapts Futures, Promises, Enumerators and Iteratees into Reactive Streams’ Publishers and Subscribers.

§Known issues

§Usage

Include the Reactive Streams integration library into your project.

libraryDependencies += "com.typesafe.play" %% "play-streams-experimental" % "2.4.0-M2"

All access to the module is through the Streams object.

Here is an example that adapts a Future into a single-element Publisher.

val fut: Future[Int] = Future { ... }
val pubr: Publisher[Int] = Streams.futureToPublisher(fut)

See the Streams object’s API documentation for more information.

Next: Hacking Play