(あなたは実際にどの俳優を言っていないので、Akkaの答えも大丈夫だと思います)
このsender
メソッドはActorRef
、送信サイトで暗黙的または明示的に取得された を提供します。!
アクター内で使用すると、それimplicit val self: ActorRef
が検出されて使用されます。その送信者がActorSystem
受信者とは異なる場所に住んでいる場合、つまりリモート メッセージ送信の場合、sender
ref には返信に必要なすべての情報が含まれます。そのパスを確認してください。
val s = sender // Actor[akka://<system>@<host>:<port>/user/path/to/actor]
val p = s.path // akka://<system>@<host>:<port>/user/path/to/actor
val a = p.address // akka://<system>@<host>:<port>
val host = a.host // Some(<host>), where <host> is the listen address as configured for the remote system
val port = a.port // Some(<port>), where <port> is the actual listen port of the remote system
したがって、要するにsender.path.address.host
(およびポートのアナログ)は、必要なものを提供するはずです。