ClusterSharding stopping ShardedDaemonProcess actors

Hi, I currently have a process on which the ActorSystem starts a ShardedDaemonProcess across clusters.

However, in some situations, I have to stop all the actors running on the actorSystem and ShardeDaemonProcess (without stopping the actorSystem actor) on all clusters.

Is there a way to stop a ShardedDaemonProcess and all its child actors, but keep the actorSystem Actor?

There is no way to have a more fine grained lifecycle control of the Sharded Daemon Process, it is tied to actor system/cluster node as it is right now, and it would be hard to implement since that depends on Akka Cluster Sharding having such functionality.

You could potentially message the actors running in SDP with some stop message, but since SDP will keep pinging the specified indexes they will restart if you stop them, and also, if the processes are rebalanced by sharding, the new instances will not know that the previous ones got such a stop message and likely start anew.

I think you will have to figure out some alternative solution not using SDP if stopping the processes, but keeping the cluster nodes alive, is a hard requirement in your use case.

Hi @johanandren, I sorry for the late reply and thanks for the above suggestions.

I ended up solving the situation, not by stopping the actors, but by halting all of their activity. That way they stop interfering with the current flow and I don’t have the ShardedDaemonProcess restating them.

Once again, thanks for the suggestions.