发件人被设置为" deadLetters"从外面向Akka路由器发送消息时(播放2.4)

时间:2016-04-28 14:41:49

标签: scala playframework akka guice

我有一些课程向演员发送消息

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]

为什么路由器会丢失发件人信息,如何恢复发件人?

0 个答案:

没有答案