§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 new standard that gives a common API for asynchronous streams. Play 2.4 introduces some wrappers to convert Play’s Iteratees and Enumerators into Reactive Streams objects. This means that Play can integrate with other software that supports Reactive Streams, e.g. Akka Streams, RxJava and others.

The purpose of the API is:

This API is highly experimental. It should be reasonably free of bugs, but its methods and classes and concepts are very likely to change in the future.

§Known issues


Include the Reactive Streams integration library into your project.

libraryDependencies += "" %% "play-streams-experimental" % "2.4.x"

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.

For more examples you can look at the code used by the experimental Akka HTTP server backend. Here are the main files where you can find examples:

Next: Play を Hack する

このドキュメントの翻訳は Play チームによってメンテナンスされているものではありません。 間違いを見つけた場合、このページのソースコードを ここ で確認することができます。 ドキュメントガイドライン を読んで、お気軽にプルリクエストを送ってください。