We use EventSourcedBehavior from akka-persistence 2.6.15 for an CQRS/EventSourcing application, with akka-persistence-jdbc 4.0.0 for storing events and snapshots in PostgreSQL DB.
We have state classes that we serialize with snapshots. But sometimes those state classes change, which makes reading snapshot fail obviously. We manage it by deleting those changed snapshots:
delete from snapshot sn
where sn.persistence_id::uuid in (select id from some_entity_table);
But for entities with a lot of events, when sending a new command, it takes a lot of time to get to the latest snapshot, resulting in timeout.
Would it be possible to force a rebuild of snapshots at the startup of the application?