开发者

scala doesn't like self variable in akka?

import actors.Actor
import akka.actor.Actor._
class HelloWorldActor extends Actor {
  def receive = {
    case msg => self reply (msg + "world")
  }
}
remote.start("localhost",9999).register(
  "hello-service", actorOf[HelloWorldActor]
)

I'm getting the follow error with my code: error: not f开发者_开发百科ound: value self


Well, that's because you've imported Scala Actors:

actors.Actor

and then try to create an instance of it using Akka.

If you change:

actors.Actor

to

akka.actor.Actor

everything will be just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜