As far as I can tell from the documentation, this is the proper way to listen for dead letters. Can anyone tell me why the "dead letter" event seems to be ignored with this code? All it does is print the number 12345, but I would expect it to also print the fact that it got a dead letter. My versions are: <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>2.11.2</version> </dependency> <dependency> <groupId>com.typesafe.akka</groupId> <artifactId>akka-actor_2.11</artifactId> <version>2.3.6</version> </dependency>
import akka.actor.{ActorSystem, Actor, DeadLetter, Props} object DeadLetterApp extends App { class Listener extends Actor { def receive = { case d: DeadLetter => println(s"got dead letter $d") case null => println("expected a dead letter, but got <null>") case x => println(s"expected a dead letter, but got $x of type ${x.getClass.getName}") } } class MyActor(readyToStop: => Unit) extends Actor { override def receive: Receive = { case x:Int => println(x) case 'stop => readyToStop } } val system = ActorSystem() val listener = system.actorOf(Props(classOf[Listener])) val myActor = system.actorOf(Props(classOf[MyActor], system.shutdown _)) system.eventStream.subscribe(listener, classOf[DeadLetter]) myActor ! 12345 myActor ! "dead letter" myActor ! 'stop } -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.