I am looking for a way to lookup the local snapshot store actor in order to delete snapshots, because in Akka typed I have no API anymore to clean-up ALL events when a persistent actor is not needed anymore. See How to remove/clean-up state of EventSourcedBehavior when task done?
My current approach is to lookup the persistent actor and send a DeleteSnapshots
message to it. This is fine. But the code looks really hacky and I am wondering if there is a better way to lookup the actor. My code looks like this:
ActorPath path = _context.getSelf().path().root().child("system").child("akka.persistence.snapshot-store.local");
ActorSelection actorSelection = _context.classicActorContext().actorSelection(path);
actorSelection.tell(new SnapshotProtocol.DeleteSnapshots(persistenceId().id(), SnapshotSelectionCriteria.latest()),
Adapter.toClassic(_context.getSelf()));
Any suggestion?
1 post - 1 participant