“ActorRef”在接收端的路径已更改。

huangapple go评论53阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月13日 18:59:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76464209.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定