我正在尝试将循环池与ClusterActorRefProvider一起使用,并将actor部署到具有特定角色的成员。
演员是远程创建和执行的,这很好,但我注意到每次我告诉路由器这是意料之外的其他成员。
[INFO] [08/10/2015 00:15:55.507] [ClusterSystem-akka.actor.default-dispatcher-2] [Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@127.0.0.1:41362] - Welcome from [akka.tcp://ClusterSystem@127.0.0.1:4054]
[INFO] [08/10/2015 00:15:55.744] [ClusterSystem-akka.actor.default-dispatcher-7] [Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@127.0.0.1:41380] - Welcome from [akka.tcp://ClusterSystem@127.0.0.1:4054]
配置定义如下:
akka {
actor {
provider = "akka.cluster.ClusterActorRefProvider"
deployment {
"/container/hello" {
router = round-robin-pool
nr-or-instances = 30
cluster {
enabled = on
max-nr-of-instances-per-node = 3
allow-local-routees = off
use-role = server
}
}
}
}
remote {
log-remote-lifecycle-events = DEBUG
log-received-messages = on
netty.tcp {
hostname = "127.0.0.1"
port = 0
}
}
cluster {
min-nr-of-members = 3
seed-nodes = [
"akka.tcp://ClusterSystem@127.0.0.1:4054"
]
roles = ["client"]
auto-down-unreachable-after = 10s
}
}
任何帮助表示感谢。
AKKA版本:" 2.3.12"
答案 0 :(得分:0)
在仔细研究问题的细节后,我发现问题不在于配置,而在于代码本身。 我做了一个错字并且有:
def system = ActorSystem("mySystem")
而不是
val system = ....
因此,每次使用系统时都会实例化actor系统。