await

Scala 2.10 and Akka 2.0 and 2.1 import problems (Await, Future, Duration)

As a quick note, import statements that used to be like this with Akka 2.0:

import akka.dispatch.Await
import akka.dispatch.Future
import akka.util.duration._

are now like this with Akka 2.1 and Scala 2.10.x:

import scala.concurrent.{Await, Future}
import scala.concurrent.duration._

The Duration object in Akka 2.0 has also been moved, and it’s now included with the scala.concurrent.duration._ import statement.

Scala: A simple Akka “Futures” example

Akka Futures FAQ: Can you share a simple example that shows how to use an Akka Future?

Sure. To fix a problem in my Sarah application I needed to be able to run some operations concurrently. After digging through the Akka Actors documentation I found that you can run simple operations as a Future, almost as easily as this:

An Akka actors ‘ask’ example - ask, future, await, timeout, duration, and all that

Akka actor ask FAQ: Can you share an example that shows how one Akka actor can ask another actor for information?

Sure. Here's a quick example to demonstrate how one Akka actor can ask another Akka actor for some information and wait for a reply. When using this "ask" functionality, you can either use the "ask" method, or the "?" operator, and I've shown both approaches below.