我已阅读此文档https://doc.akka.io/docs/akka/current/general/message-delivery-reliability.html#dead-letters,其中说:
演员可以订阅事件流上的 akka.actor.DeadLetter 类,请参阅事件流了解如何做到这一点。
在事件流文档:https : //doc.akka.io/docs/akka/current/event-bus.html#event-stream 中,示例代码似乎与经典 Akka 有关,而包akka.actor.ActorSystem不是akka.actor.typed.ActorSystem:
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
final ActorSystem system = ActorSystem.create("DeadLetters");
final ActorRef actor = system.actorOf(Props.create(DeadLetterActor.class));
system.getEventStream().subscribe(actor, DeadLetter.class);
Run Code Online (Sandbox Code Playgroud)
但是在 Akka Typed 中,没有subscribe()在akka.actor.typed.ActorSystem.eventStream().