我认为我的配置存在一些问题。请考虑以下设置:
在“接收者”节点上:
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来创建actor,但我认为在这种情况下无关紧要)
问题是,当我从Receiver节点actor发送消息时:
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
...
当我从“receiver”节点直接向该路由器发送消息时,所有消息都成功传递给“处理器”:
system.actorFor(
"akka.tcp://robot-system@172.18.0.4:2552/user/processorRouter")
.tell(data, ActorRef.noSender());
无法找到群集感知路由器配置的问题。请帮帮我!