Created
December 14, 2012 16:20
-
-
Save anonymous/4286633 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autoCompilerPlugins := true, | |
libraryDependencies <+= scalaVersion { | |
v => compilerPlugin("org.scala-lang.plugins" % "continuations" % "2.10.0-RC5") | |
}, | |
scalacOptions += "-P:continuations:enable", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"com.typesafe.akka" %% "akka-dataflow" % "2.1.0-RC5" cross CrossVersion.full // Substitute the Akka version number to the final once it's released |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.concurrent.ExecutionContext.Implicits.global // to have the default ExecutionContext in scope | |
import scala.concurrent.future | |
import akka.dataflow._ // to have access to flow + the conversions from Futures and Promises to dataflow constructs | |
val f1: Future[Long] = future { 1 * 5 } | |
val f2: Future[Long] = future { 3 * 5 } | |
flow { f1() + f2() } onComplete println // Will (asynchronously) print out the sum of the result of f1 and f2 once they are done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment