I'm doing a little sample to learn a bit about Akka.NET. I'm trying to implement a Child-Per-Entity pattern (as seen in Akka.NET Design Patterns), where I have one actor per user (across a cluster).
To do this I was trying to use a ClusterRouterPool with ConsistentHashingPool, that distributed the messages to some parent actors that kept an IDictionary(int,IActorRef) with the child actors indexed by their id (used as the key for the consistent hash).
This approach however doesn't seem to be working as I initially expected because:
- Having different clients creating routers will result in them creating multiple parent actors, which in turn will create repeated child actors.
- Even if I had a single router, if a new node joins the cluster what happens? Wouldn't the router re-balance itself causing again the routing being made to new parent actors that would create repeated child actors?
There's a somewhat similar question here on StackOverflow that points to using Akka.Cluster.Sharding, but on Akka.NET Design Patterns Aaron has a comment stating he used the consistent hash router approach, hence why I started it in the first place.
Thanks