Skip to content

Instantly share code, notes, and snippets.

@diegovar
Created October 5, 2012 20:55
Show Gist options
  • Save diegovar/3842347 to your computer and use it in GitHub Desktop.
Save diegovar/3842347 to your computer and use it in GitHub Desktop.
Play promise to Akka future
/**
* This is a helper function because there is no existing conversion from Play promise to Akka future in Play.
* @param promise
* @tparam A
* @return
*/
implicit def toAkkaFuture[A](promise: PlayPromise[A]): Future[A] = {
val p = akka.dispatch.Promise[A]()
promise extend1 {
case Redeemed(value) => p success value
case Thrown(exn) => p failure exn
}
p.future
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment