英文:
path of ActorRef changed in receivers end
问题
在创建了该actor之后,
actorRef.path().toString()
正确返回路径 akka://syst/user/ker/def
但是当在接收端调用相同的方法时,字符串会附加 $a 或 $c,如下所示。
getSender().path().toString()
akka://syst/user/ker/def/$c
这是由于actor实例的重启还是由于其他原因引起的?如何确保actorref的路径是唯一的?
英文:
After creating the actor
actorRef.path().toString()
returns the path correctly akka://syst/user/ker/def
but when the same method called at the receivers end, $a or $c attached to the string as follows.
getSender().path().toString()
akka://syst/user/ker/def/$c
is this due to reboot of actor instance or due to any other reason?
How to keep the path in actorref unique?
答案1
得分: 1
"/$a"或"/$c"表示您正在接收演员的子项,而不是演员本身。额外的"/"表示子项关系。而"$a"和"$c"表示它可能是自动生成的内容,例如计时器或(正如Levi建议的)ask
模式的一部分。
要理解为什么您接收到子项而不是父项,您需要提供一个代码示例。
英文:
The "/$a" or "/$c" is indicating that you are receiving a child of the actor, rather than an actor itself. The additional "/" is indicating the child relationship. And the "$a" and "$c" are indicating that it's likely something autogenerated like a timer or (as Levi suggests) part of the ask
pattern.
You'd have to provide a code example to understand why you are receiving the child rather than the parent.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论