I have a lot of quite short lived (< 5-10 sec) Saga actors/entities for which I use typed persistence and cluster sharding with durable storage and remember entities = true. From what I can see, both the persisted events and also the durable data state in the
DurableStore of cluster sharding are not deleted when I stop my entity.
I understand that the persisted events are not deleted but I would expect that the relevant keys in the durable ddata store are at least deleted.
My question is: Whats the preferred way to delete this 2 things, persisted events and more importantly the durable ddata state? (as I am using remember entities = true, which leads to always loading ALL entities after a cluster startup!)
Note: I implemented my own
DurableStore which uses JDBC to store the state in postgres.
Deleting events: I could implement a cleanup task which runs on service startup (or shutdown) and searches for all finished sagas (by querying the event store for
SagaFinished events) and then delete those.
Deleting ddata state: What I can think of here is register my
DurableStore with the
Receptionist and when a Saga finished I could lookup the
DurableStore actor and send it a message to delete the state for this entity/saga.
Any other/better ideas?