Get existing or create new akka actor

后端 未结 3 1599
生来不讨喜
生来不讨喜 2020-12-31 17:33

I\'m trying to get an existing ActorRef with ActorFor or create a new one if it does not exists. I have the following code but it doesn\'t seem to work as expected. .isTermi

3条回答
  •  悲&欢浪女
    2020-12-31 18:26

    Change your lookup to be:

    system.actorFor("/user/" + name)
    

    You don't need the "akka://System" part if this is a local actor you are looking up. This is assuming that this actor was already started up elsewhere in your code though. If not it won't work.

提交回复
热议问题