捕捉死信 Akka.NET V 1.1.0

Catch DeadLetters Akka.NET V 1.1.0

我可以在 Akka.Net V 1.0.8

中使用此语法订阅死信
 Cluster.Get(Context.System).Subscribe(Self, ClusterEvent.InitialStateAsEvents, new[] { typeof(DeadLetter)});

但是当我尝试在 V 1.1.0 中使用相同的语法时,出现以下异常!

An exception of type 'System.ArgumentException' occurred in Akka.Cluster.dll but was not handled in user code

Additional information: Subscribe to IClusterDomainEvent or subclasses, was [DeadLetter]

集群订阅用于接收与集群生命周期相关的事件。死信(就像其他日志消息一样)被发布到事件总线中,因此您需要使用 Context.System.EventStream.Subscribe(Self, typeof (DeadLetter)).

订阅它

考虑到,事件总线只能在本地订阅,来自生活在同一个演员系统中的演员。