How to Passivate a EventSourcedBehavior entity

The only example in the documentation suggest to send a Passivate message to shard.

https://doc.akka.io/docs/akka/current/typed/cluster-sharding.html#passivation

shard.tell(new ClusterSharding.Passivate<>(getContext().getSelf()));

But for EventSourcedBehavior Actors, they do not have reference to ActorRef which is needed param to create Passivate

Easiest is to use automatic passivation based on configuration. https://doc.akka.io/docs/akka/current/typed/cluster-sharding.html#automatic-passivation

The ActorContext can be used in EvenSourcrdBehavior in same way as other behaviors. https://doc.akka.io/docs/akka/current/typed/persistence.html#accessing-the-actorcontext

Thanks Patrik for the link, I am very new to Akka (2 weeks).

My primary goal is to have a fail safe always-on actor which can recover automatically. I used event sourced + Remember Entities for this, since this actor also has to a Timer which calls itself at certain schedule time. So when actor is reincarnated after crash, the timer event can set it up again.

My next goal is to properly delete/kill/remove/erase this Actor from the system after the timer is kicked off. Can you please guide what is the best recommended way of doing this.

After passivation it will not be started by remember entities again.