我有一些课程向演员发送消息
class SenderImpl @Inject() (@Named("routerActor") routerActor: ActorRef) {
routerActor ! "Hello"
}
以及接收此消息的actor类
@Singleton
class RouterActor @Inject() extends Actor {
override def receive: Receive = {
case msg => println(s"sender = ${sender()}")
}
}
RouterActor在一个单独的类中注入路由器:
bindActor[RouterActor]("routerActor", RoundRobinPool(10).props)
结果:sender = Actor [akka:// application / deadLetters]
如果将RouterActor注入为单个actor:
bindActor[RouterActor]("routerActor")
结果:sender = Actor [akka:// application / temp / $ a]
为什么路由器会丢失发件人信息,如何恢复发件人?