Hello!
I have a cluster configuration like this:
"/cluster_router_httpworker" {
router = consistent-hashing-group
nr-of-instances = 10
routees.paths = [ "/user/router_httpworker" ]
cluster {
enabled = on
max-nr-of-instances-per-node = 5
allow-local-routees = off
use-role = "http"
}
},
"/cluster_router_chunkworker" {
router = consistent-hashing-group
nr-of-instances = 5
routees.paths = ["/user/router_chunkworker" ]
cluster {
enabled = on
max-nr-of-instances-per-node = 1
allow-local-routees = off
use-role = "chunk"
}
}
Now I start a
TaskChunkActor the as below:
val sys = ActorSystem("HttpCluster", config)
val ref = sys.actorOf(Props[TaskChunkActor].withRouter(RoundRobinPool(10)), "router_chunkworker")
val clusterRef = sys.actorOf(FromConfig.props(Props.empty), "cluster_router_chunkworker")
The
TaskChunkActor initializes its internal references to the
HttpWorker :
val httpWorkers = context.system.actorOf(FromConfig.props(Props.empty), "cluster_router_httpworker")
At this point I'm getting the exception:
akka.actor.InvalidActorNameException: actor name [cluster_router_httpworker] is not unique!
at akka.actor.dungeon.ChildrenContainer$NormalChildrenContainer.reserve(ChildrenContainer.scala:130)
at akka.actor.dungeon.Children$class.reserveChild(Children.scala:76)
at akka.actor.ActorCell.reserveChild(ActorCell.scala:369)
at akka.actor.dungeon.Children$class.makeChild(Children.scala:201)
at akka.actor.dungeon.Children$class.attachChild(Children.scala:41)
at akka.actor.ActorCell.attachChild(ActorCell.scala:369)
at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:553)
It seems that every
TaskChunkActor tries to create it's own reference to the cluster-related actor, and fails.
I see that I could pass the route to every instance of
TaskChunkActor via constructor, but perhaps there's a way to either create an instance of the actor from config or return the existing one?
Thanks!