Java – akka – implement a custom deadletterlistener actor

I'm trying to add other behaviors to deal with dead letters in akka I think the best way is to implement our own dead letter listener, but I can't find any documentation on how to integrate our own actor instead of the default dead letter listener

Is there any documentation on how to do this (or are there other ways to extend or override the behavior of these default implementations)?

Solution

You should subscribe to eventstream

import akka.actor.{ Actor,DeadLetter,Props }

class Listener extends Actor {
  def receive = {
    case d: DeadLetter => println(d)
  }
}

val listener = system.actorOf(Props(classOf[Listener]))
system.eventStream.subscribe(listener,classOf[DeadLetter])
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>