我相信我的配置有问题。请考虑以下设置:
在“接收者”节点上:
List<String> path = singletonList("/user/processorRouter");
processorRouter = context().actorOf(
new ClusterRouterGroup(new RoundRobinGroup(path),
new ClusterRouterGroupSettings(10, path, false, "processor")).props(), "clusterProcessorRouter");
在“处理器”节点上(它具有“处理器”角色):
ActorRef processorRouter = system.actorOf(
SpringProps.create(system, ProcessorActor.class).withRouter(
new RoundRobinPool(10)), "processorRouter");
(我正在使用 Spring Extension 来创建演员,但我相信在这种情况下并不重要)
问题是,当我从 Receiver 节点参与者发送消息时:
processorRouter.tell(data, self());
Akka 仅有时会传递此消息。这里我可以在日志中看到:
receiver_1: Receiver sent a message to processor: TEST
receiver_1: Receiver sent a message to processor: TEST
receiver_1: Receiver sent a message to processor: TEST
receiver_1: Receiver sent a message to processor: TEST
receiver_1: Receiver sent a message to processor: TEST
processor_1: Processor got a message: TEST
receiver_1: Receiver sent a message to processor: TEST
receiver_1: Receiver sent a message to processor: TEST
...
当我从“接收者”节点直接向该路由器发送消息时,所有消息都成功传递到“处理器”:
system.actorFor(
"akka.tcp://robot-system@172.18.0.4:2552/user/processorRouter")
.tell(data, ActorRef.noSender());
找不到集群感知路由器配置的问题。请帮我!