2.1 Spotlight: Dataflow API on SIP-14

For Akka 2.1 we have reimplemented the Dataflow API to be based on implicit value classes, both to be able to add the API to the Futures that have been moved into the Scala Standard Library, and to keep performance at an acceptable level.

The good news is that the API looks and feels exactly the same as in 2.0.x, so let’s see what Dataflow enables.

First, we need to enable the Scala Continuation Passing Style (CPS) plugin:

Secondly we need to add the dependency to Akka Dataflow:

Dataflow consists of a couple of different parts, the flow construct + operators for setting and getting values.

Since Dataflow is implemented on top of Future and Promise, we can also smoothly integrate with everything that consumes and produces them.

Here’s an example of spawning 2 computations and joining their results asynchronously:

Read more about Dataflow Concurrency in the Akka Reference Documentation: http://doc.akka.io/docs/akka/2.1.0-RC5/scala/dataflow.html

Recent comments

Blog comments powered by Disqus