Akka typed shard region graceful shutdown

Hi there, in akka untyped there is a ShardRegion.GracefulShutdown message that allows shutting down a ShardRegion actor. Is there a similar mechanism in akka clustering typed?

I’m trying to use this for testing recovery of persistent actors. I can of course shut down the whole cluster or wait for passivation, or I could even have the persitent actors themselves ask for passivation upon some trigger, but I was wondering if this got left out by design?

Sorry for delayed response. Since the graceful shutdown is now integrated in CoordinatedShutdown of the ActorSystem we don’t think there is a need for specific API for it.

Good to know, thanks!

Patrik, I was wondering what approach you’d recommend should one really like to test functionality that involves a ShardRegion going down. Consider the scenario where another actor is watching the ShardRegion and would fire some action if the region goes down. At the moment, I use the adapter and do the following to forcefully stop the region: testKit.system.toUntyped.actorSelection(shardRegion.path).tell(PoisonPill, probe.ref.toUntyped)

Not the prettiest thing ever but does the job. I couldn’t find better a better alternative in the akka test suite, but there’s always the possibility such functionality exists and I’ve missed it.

If you want to test something mote tealistic you can send Leave to the Cluster extension.

1 Like

A much better idea, indeed. Thanks.!