How to view akka dead letters

前端 未结 1 398
灰色年华
灰色年华 2021-02-04 07:27

I\'ve created an Actor that performs some basic operations and appears to be working correctly - however I\'m seeing the following show up in my logs regularly

[         


        
相关标签:
1条回答
  • 2021-02-04 08:11

    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)
    
    0 讨论(0)
提交回复
热议问题