Alan Coromano
Alan Coromano

Reputation: 26008

Cannot find Await from akka

I have an error of importing Await from akka.io. Here is my build.sbt:

name := "Project1"

version := "0.1"

scalaVersion := "2.10.1"

libraryDependencies += "org.json4s" %% "json4s-native" % "3.2.4"

resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

libraryDependencies += "com.typesafe.akka" % "akka-actor_2.10" % "2.1.4"

Here is a part of a code:

import akka.actor.Actor
import akka.actor.ActorSystem
import akka.actor.Props
import akka.dispatch.Await
import akka.pattern.ask


//.......
private def resultId = {
    private val someActor = context.actorSelection("../someActor123") // defined in   Application object
    val future = someActor ? SomeMessage
    val result = Await.result(future, 1.timeout).asInstanceOf[String]
  }

It says object Await is not a member of package akka.dispatch and value ? is not a member of akka.actor.ActorSelection and not found: value Await

Of course, I reloaded it and did gen-idea.

Upvotes: 4

Views: 1872

Answers (1)

senia
senia

Reputation: 38045

As @S.R.I noted you should use scala.concurrent.Await instead of akka.dispatch.Await.

value ? is not a member of akka.actor.ActorSelection

There is no ask pattern support for ActorSelection in version 2.1.4. See this commit. Ask support for ActorSelection is available only after version 2.2.

Upvotes: 8

Related Questions