这就是我的发现,对于我的生活,我无法找到原因。我正在创建“打印机”actor,它们基本上要么什么都不做,要么根据他们收到的消息类型打印一条消息。
class Printer extends Actor {
def receive = {
case m: SomeMessage => println( m.text )
case _ =>
}
}
我正在创建其中几个演员:
val actor4 = system.actorOf(Props[Printer], "t-4")
val actor5 = system.actorOf(Props[Printer], "t-5")
val actor6 = system.actorOf(Props[Printer], "t-6")
并将它们放入向量中:
val routees2 = Vector[ActorRef](actor4, actor5, actor6)
我正在执行上述操作,以便可以将它们放入路由器中(它们将在路由器的控制之下)。到目前为止,当我运行规范时,我没有任何问题。一旦我将它们放入路由器并运行规范,我就会遇到问题。这是路由器:
val router = system.actorOf(Props[Printer].withRouter(
BroadcastRouter(routees = routees2)), "router-to-transformers")
现在,当我运行规范时,我有各种各样的死信......
[INFO] [09/23/2013 17:10:21.468] [spider-akka.actor.default-dispatcher-6] [akka://spider/user/router-to-transformers] Message [akka.dispatch.sysmsg.DeathWatchNotification] from Actor[akka://spider/user/router-to-transformers#-1845250548] to Actor[akka://spider/user/rout
er-to-transformers#-1845250548] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [09/23/2013 17:10:21.468] [spider-akka.actor.default-dispatcher-6] [akka://spider/user/router-to-transformers] Message [akka.dispatch.sysmsg.DeathWatchNotification] from Actor[akka://spider/user/router-to-transformers#-1845250548] to Actor[akka://spider/user/rout
er-to-transformers#-1845250548] was not delivered. [2] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [09/23/2013 17:10:21.468] [spider-akka.actor.default-dispatcher-6] [akka://spider/user/router-to-transformers] Message [akka.dispatch.sysmsg.DeathWatchNotification] from Actor[akka://spider/user/router-to-transformers#-1845250548] to Actor[akka://spider/user/rout
er-to-transformers#-1845250548] was not delivered. [3] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
对于我的生活,我无法弄清楚这里发生了什么。我添加了一个指向测试片段的链接。代码段中的编号很奇怪,因为我已经删除了一堆不同的尝试,这些尝试被注释掉了,以免弄乱代码段。我专注于这个死信问题,因为我觉得当我添加更多演员并实际上开始传递消息时,事情没有得到传递...... http://snipt.org/AhVf0
值得一提的是,这些演员都是本地人。我读过一些关于 actorFor 被贬值的内容,我想知道它是否被使用并且部分是导致我的问题的原因?虽然这里有很多活动部件,但没有很多稳定、全面的文档。任何帮助将不胜感激。