Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find Await from akka

Tags:

scala

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.

like image 334
Alan Coromano Avatar asked Feb 15 '23 19:02

Alan Coromano


1 Answers

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.

like image 186
senia Avatar answered Feb 23 '23 20:02

senia