Advertisement
Guest User

scala ask pattern example

a guest
Apr 20th, 2015
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.38 KB | None | 0 0
  1. imports:
  2. import akka.pattern.ask
  3. import akka.util.Timeout
  4. import scala.concurrent.duration._
  5. import scala.util.{Failure, Success}
  6. import scala.concurrent.ExecutionContext.Implicits.global
  7.  
  8. code:
  9. implicit val _timeout = Timeout(5000.milliseconds)
  10. val f = worker ? DoWork(work)
  11.  
  12. f.onComplete{
  13.   case Success(result) => log.info("good")
  14.   case Failure(result) => log.info("bad")
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement