Cluster Aware Routers and ActorSelection issue

akka-cluster

(Joa23) #1

Hi there,
(sorry for cross-posting - I just noticed the mailing list is deprecated)
As I’m getting up to speed on Akka cluster I have trouble using Cluster Aware Routers and actor selection within the cluster.
I’m using the factorial cluster example as a starting point but when I adding some Actors lower in the hierarchy on the backend I have trouble to reach the router group:

conf:

akka.actor.deployment {

  /factorialFrontend/factorialBackendRouter = {

    router = cluster-metrics-adaptive-group

    metrics-selector = mix

    routees.paths = ["/user/factorialBackend"]

    cluster {

      enabled = on

      use-role = backend

      allow-local-routees = off

    }

  }

}

Code:

// Does not work.

getContext().actorSelection("/factorialFrontend/factorialBackendRouter");

I’m rather confused about why the router group is under FactorialFrontend and there seems no way to create a router group on the highest level (e.g. akka.actor.deployment { factorialBackendRouter =… instead of akka.actor.deployment /factorialFrontend/factorialBackendRouter =…

I’m suspecting that since the router group is under the FactorialFrontend my actor that is deployed as a child of the backend can’t reach the router group.

Any suggestions what I’m doing wrong? Clearly, I have an understanding issue and would welcome some clarification that the documentation couldn’t provide me yet.

Thanks for your time.
Stefan