We, let’s say once a day, have the phenomenon the we see the following error in our logfiles:
Error reading snapshot. Reconstructing aggregate from entire event stream. Caused by: javax.persistence.PersistenceException org.hibernate.exception.GenericJDBCException: could not extract ResultSet
Since our aggregate is constructed out of hundreds and thousands of events, simply reconstructing takes quite a long
time. I have the feeling that the error has something to do with database rollbacks and
therefore simply retrying should bring the snapshot up again.
So my question: Is there a way of retrying instead of completely rebuilding a snapshot?
That’s bothersome…and I think a correct assumption.
A simply retry on the reading of the snapshot might proof beneficial in your scenario.
I checked whether the current set up allows to retry reading a snapshot, but that’s sadly not the case as far as I can see.
What you could do, is introduce your own implementation of the [JPA/JDBC/Mongo]EventStorageEngine and override the readSnapshotData(String) function to incorporate a retry mechanism.
Alternatively, you could of course add an issue/feature request here, and let us do the work.
Or, introduce a PR introducing that functionality!
In short, it’s not available atm, but shouldn’t be to difficult to add into the framework or your personal project.