Scala 从PromiseActorRef获取原始ActorRef或路径

Scala 从PromiseActorRef获取原始ActorRef或路径,scala,akka,Scala,Akka,当覆盖Actor\aroundReceive时,如何从PromiseActorRef(由akka.pattern.ask创建)获取原始ActorRef? 我正在尝试添加一些工具来跟踪actor系统中的消息 override def aroundReceive(receive: Actor.Receive, msg: Any): Unit = { sender().path // This is something starting with "/temp/..." since it

当覆盖
Actor\aroundReceive
时,如何从
PromiseActorRef
(由
akka.pattern.ask创建)获取原始
ActorRef
? 我正在尝试添加一些工具来跟踪actor系统中的消息

  override def aroundReceive(receive: Actor.Receive, msg: Any): Unit = {
    sender().path // This is something starting with "/temp/..." since it 
                  // references the PromiseActorRef created by an ask,   
                  // instead, I would like to get a reference or path 
                  // to the actor invoking ask originally
    super.aroundReceive(receive, msg)
  }

你试过挑选演员吗?实际上,只有在执行actor1时,临时参与者才会调用ask?我们正在向actor1请求某些内容,但在内部生成了一个临时参与者,该临时参与者将消息发送给actor1。感谢@RamanMishra的建议,但我不确定在此上下文中使用哪条路径,我在这里拥有的唯一路径是我从sender()获得的路径。路径是在请求后创建的临时参与者的路径(该路径以“/temp/…”开头)。您是否尝试过演员选择?实际上,只有当我们执行actor1时,临时演员才会调用ask?我们正在向actor1发出请求,但在内部生成了一个临时演员,该临时演员会将消息发送给actor1。感谢@RamanMishra的建议,但我不确定在此上下文中使用什么路径,我这里唯一的路径是e我从sender().path获得的路径,它是在ask之后创建的临时参与者的路径(该路径以“/temp/…”开头)。