从ActorRef获取AKKA演员姓名

时间:2015-11-29 11:12:38

标签: akka actor

有没有办法从AKKA的ActorRef获取演员姓名?

我指的是一个给演员的名字:

val myActorRef = context.actorOf(props, "MyActorName")

1 个答案:

答案 0 :(得分:5)

可从路径访问该名称:

val name = myActorRef.path.name

同样,名称也在路径元素中:

val nameAgain = myActorRef.path.elements.last