Is it possible to stop cluster sharding entities (stop processing of commands) without shutting down the whole application (cluster), and later resume the processing?
Another question: is it possible to send Passivate message to a shard region from an actor that is not Entity? I guess it is not possible, especially in Akka-Typed, because only the Entity can obtain a reference to the ShardRegion actor.
Hi @pawelkaczor
Is it possible to stop cluster sharding entities (stop processing of commands) without shutting down the whole application (cluster), and later resume the processing?
Entities can be stopped automatically if they don’t receive a message for a set amount of time by setting akka.cluster.sharding.passivate-idle-entity-after
or by setting passivateIdleEntityAfter
on the settings.
I see you’ve already found ActorRef[ShardCommand]
for sending Passivate. The best way from doing it outside of the Actor would be to send a message to the actor that results in it sending a Passivate to its shard.
The best way from doing it outside of the Actor would be to send a message to the actor that results in it sending a Passivate to its shard.
Thanks. Indeed. I’ve already came up with the same idea.
I was aware of Passivation, but I was looking for a different mechanism. Generally I want to stop a Service… Anyway, I realized that in my scenario Passivation is enough.
But, I have similar problem with Cluster Singleton. I would like to stop it, and then start again. For now I know how to stop it (by sending Stop Message). The question is how to start it again? akka.cluster.typed.ClusterSingleton#init does not work.