Is there an EventAdapter for snapshots

Hi,

I’m new to Akka, so if I’ve complete misunderstood everything, please be gentle. :wink:

I’m trying to implement a PersistentActor and use EventAdapters to separate between a hand-made domain model and a generated storage model (e.g. Protobuf). I understand how to implement this for events written to the journal.

The part I haven’t quite understood yet is how to do that for snapshots of the actor’s state. I want the actor to work with its state in terms of the domain model, but I would like it to be saved as a snapshot using the generated storage model.

From what I understand, EventAdapters only seem to apply for the journal, not snapshots. Is there a similar mechanism for snapshots? Or am I thinking completely wrong regarding the snapshots?

Best
Henrik

I would do that transformation in a serializer.

There are no event adapter for snapshots. The original purpose of event adapters was for migration of events when the classes evolve. For snapshots the thought was that they can be thrown away and replay events instead or store new snapshot format.

Ah, ok. Is there any support for detecting “broken” snapshots? If I change the state domain classes, some serialization protocols will fail to deserialize the stored snapshot (e.g. Java serialization). Can I detect this and then choose to delete the broken snapshot?

The Cassandra snapshot plugin will try a few old snapshots and then fallback to replay all events.

Not sure about other plugins, but in general there is no way unless you do it in your serializer.

Ok, thank you for the clear answers!

/Henrik