We're going to use cluster sharding to route messages to the appropriate actors on the servers in a cluster. We'll have many actors that will be sending messages via the ShardRegion actor, and were thinking originally we'd inject that actor as a dependency into the actors that need it as we do other dependencies (e.g., an event bus).
But since ClusterSharding.shardRegion() returns an ActorRef, presumably that could become stale (if the ShardRegion actor was restarted) and hence wouldn't make sense as an injected dependency. The alternatives I can think of are 1) obtaining the ShardRegion's ActorSelection and passing that as the dependency, or 2) passing in the shard entry name and calling ClusterSharding.shardRegion() every time to get the current ActorRef. Of these, 1) is definitely cleaner as it doesn't couple the dependent actors to ClusterSharding at all. Am I right in assuming that the performance overhead of 1) and 2) are comparable, and negligible in the grand scheme of things, compared to sending directly to the ActorRef? thx, Chris -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
