0

I am using ConsistentHashingGroup and I would like to be notified when Akka node in the cluster that had routees for the group went down.

Is there any way to do so without subscribing to cluster events? What is the best way of finding which routees where placed on the crashed node? I would like to that to recover data for those routees from persistent storage.

1 Answer 1

0

That would require listening to cluster events. With the consistent hashing, when the node topology changes (nodes are removed or added) using hashing for routing will mean that the messages may start going to another actor than it was routed to before. To know what hashes went to a specific actor, you'd likely have to report back from the actor for every message. If the state is tied to specific hashes it will be problematic though, because how can you guarantee you got to restore the right state before a message was routed to the actor.

You may want to look into Akka Cluster Sharding which does routing based on an identifier, and makes sure there is only one actor alive for a given id, rebalancing when the cluster changes etc. Very useful for persistent state bound to a specific recipient.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.