How to view akka dead letters

匆匆过客 提交于 2019-12-03 02:07:37
cmbaxter

As mentioned in the comment by @wingedsubmariner, you can subscribe to the DeadLetter event on the main system EventStream to be notified when deadletters happen and be able to react to that situation in a more custom manner. In order to subscribe, the code would look like this:

context.system.eventStream.subscribe(myListenerActorRef, classOf[DeadLetter])

Then, the receive for that listener actor could look something like this:

def receive = {
  case DeadLetter(msg, from, to) =>
    //Do my custom stuff here
}

The structure of the DeadLetter class is:

case class DeadLetter(message: Any, sender: ActorRef, recipient: ActorRef)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!