来自`ClusterReceptionist`的消息未到达`D​​istributedPubSubMediator`

时间:2017-05-04 06:07:37

标签: scala akka cluster-computing distributed

我正在尝试通过"Dummy string"向Akka群集发送一个简单的字符串ClusterClient。设置很好,我有前端和群集连接,但Send来自DistributedPubSub的{​​{1}}调解员的ClusterReceptionist消息已发送到DeadLetters

如果我安排另一条Send消息稍后从集群内部发送给调解器,则可以正常工作。

请帮助,提前谢谢。

前端日志:

22:51:34,645 DEBUG akka.remote.EndpointWriter - sending message RemoteMessage: [Send(user/UserServiceProxy,Dummy string,true)] to [Actor[akka.tcp://PvpCluster@127.0.0.1:2552/system/receptionist#-1744655285]]<+[akka.tcp://PvpCluster@127.0.0.1:2552/system/receptionist] from [Actor[akka://PvpFrontend/deadLetters]]
22:51:34,646 DEBUG akka.serialization.Serialization(akka://PvpFrontend) - Using serializer [akka.cluster.pubsub.protobuf.DistributedPubSubMessageSerializer] for message [akka.cluster.pubsub.DistributedPubSubMediator$Send]

群集日志:

22:51:34,626 DEBUG akka.remote.EndpointWriter - sending message RemoteMessage: [ActorIdentity([B@11b5bea7,Some(Actor[akka://PvpCluster/system/receptionist#-1744655285]))] to [Actor[akka.tcp://PvpFrontend@localhost:3000/user/cluster-client#-2107174838]]<+[akka.tcp://PvpFrontend@localhost:3000/user/cluster-client] from [Actor[akka://PvpCluster/deadLetters]]
22:51:34,654 DEBUG akka.remote.EndpointWriter - received local message RemoteMessage: [Send(user/UserServiceProxy,Dummy string,true)] to [Actor[akka://PvpCluster/system/receptionist#-1744655285]]<+[akka://PvpCluster/system/receptionist] from [Actor[akka.tcp://PvpFrontend@localhost:3000/deadLetters]()]
22:51:34,657 DEBUG akka.cluster.client.ClusterReceptionist$Internal$ClientResponseTunnel - started (akka.cluster.client.ClusterReceptionist$Internal$ClientResponseTunnel@476348f0)
22:51:34,657 DEBUG akka.cluster.client.ClusterReceptionist - now supervising Actor[akka://PvpCluster/system/receptionist/akka.tcp%3A%2F%2FPvpFrontend%40localhost%3A3000%2FdeadLetters#552013204]
22:51:34,657 INFO akka.actor.RepointableActorRef - Message [java.lang.String] from Actor[akka://PvpCluster/system/receptionist/akka.tcp%3A%2F%2FPvpFrontend%40localhost%3A3000%2FdeadLetters#552013204] to Actor[akka://PvpCluster/system/distributedPubSubMediator#-1480760039] was not delivered. [5] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
22:51:34,892 DEBUG akka.serialization.Serialization(akka://PvpCluster) - Using serializer [akka.serialization.JavaSerializer] for message [akka.remote.Ack]
22:51:36,439 DEBUG akka.remote.EndpointWriter - received local message RemoteMessage: [Heartbeat] to [Actor[akka://PvpCluster/system/receptionist#-1744655285]]<+[akka://PvpCluster/system/receptionist] from [Actor[akka.tcp://PvpFrontend@localhost:3000/user/cluster-client#-2107174838]()]
22:51:36,440 DEBUG akka.cluster.client.ClusterReceptionist - Received new contact from [akka.tcp://PvpFrontend@localhost:3000/user/cluster-client]
22:51:36,440 DEBUG akka.remote.EndpointWriter - sending message RemoteMessage: [HeartbeatRsp] to [Actor[akka.tcp://PvpFrontend@localhost:3000/user/cluster-client#-2107174838]]<+[akka.tcp://PvpFrontend@localhost:3000/user/cluster-client] from [Actor[akka://PvpCluster/system/receptionist#-1744655285]]
22:51:36,837 DEBUG akka.remote.transport.ProtocolStateActor - stopped

1 个答案:

答案 0 :(得分:0)

很难确定没有看到代码,但通常会发生这种情况,因为您忘记将收件人注册到群集客户端接待员,或者当客户端发送消息时,群集节点上的注册尚未发生(a竞争条件)。

如果邮件到达接待员并且没有注册此路径,则该邮件将转至deadLetters

将节点注册到接待员就像这样(来自the docs的样本):

val serviceA = system.actorOf(Props[Service], "serviceA")
ClusterClientReceptionist(system).registerService(serviceA)