First you’ll need a stop command as part of the messages Y accepts, let’s call that StopY, that makes it return the stopped effect. You’ll also need a graceful stop command for X, let’s call that StopX.
Configure sharding to use StopX for stopping entitles.
When you get the stop message to X you watch Y and then send it StopY
In X´ you now use the stop` effect.
Since you watched Y from X you will get a Terminated message to X when Y has stopped and can stop X as well.
Can you please share an example : I have a similar problem:
I have an sharded eventSourced persistence actor, which on recovery sends a timer message to self.
After execution of timer message, it replies to parent and stops
This again calls eventHandler and terminationHandler and goes into infinite cycle.
How to shut down / delete / terminate / erase a persistence actor permanently. If there is documentation on it, it certainly not in the right place. I have had major trouble in finding relevant documentation, its all scattered .