从akka找不到Await

Ala*_*ano 3 scala akka

我从akka.io导入Await时出错.这是我的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"
Run Code Online (Sandbox Code Playgroud)

这是代码的一部分:

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]
  }
Run Code Online (Sandbox Code Playgroud)

它说,对象Await is not a member of package akka.dispatchvalue ? is not a member of akka.actor.ActorSelectionnot found: value Await

当然,我重新加载它并做了创意.

sen*_*nia 7

正如@SRI 所说,你应该使用scala.concurrent.Await而不是akka.dispatch.Await.

价值?不是akka.actor.ActorSelection的成员

版本中没有ask模式支持.看到这个提交.询问支持仅在版本之后提供.ActorSelection2.1.4ActorSelection2.2