0
votes

I am working on changing a single node akka actor system application to be akka cluster. One change is making a type of stateful Actor (which can be many at runtime), into Cluster Sharding managed entities. Now it works fine on multiple nodes.

One problem I am facing is how to query (GET ALL) the entities created by Sharding Regions in Cluster. Previously in single node mode, it uses actor system ActorSelection to do actor path matching to get a list of matched actors, which does not work any longer in cluster sharding.

I would like to know if Sharding Region has some built-in support for querying its entities.

1

1 Answers

0
votes
  1. You need all actor systems to be in the same cluster. For that make sure they all have configured the same seed nodes.

  2. If you want to access an actor that lives in another machine you need to include its IP address in the actor selection.

  3. If you want to not require an IP address for actor selection, you will have to implement a naming system for your actors. For this you can use Zookeeper and put each entry on an ephemeral znode.

Source: solved the same problem in 2014