Recommended approach to unused events with Akka Typed persistence


I’m using EventSourcedEntity from Akka Typed. I guess I have a fairly standard setup: EventSourcedEntity with EventAdapter (typed) with custom serializer for the events (to and from proto). Events used in the business layer are plain case classes, while sbt-protoc is used to generate scala classes out of proto files. EventAdapter is used to convert one to another and handle potential events evolutions.

After running it for a while it turns out that one of the events is not worth persisting and can be “removed”. The docs on schema evolution describe possible solutions:

Unfortunately, seems like none of the approaches can be easily applied with Akka Typed, because they are based on EventAdapter returning EventSeq.empty. Typed EventAdapter has to be of type [Event, Any], so it’s not possible to return empty list (or an Option or Either) to skip a deserialized event (a tombstone).

I see some workarounds, like making the Event type of the entity to actually be a List[Event], but then it propagates to other parts. I can also just keep the event schema, let the deserializer deserialize it and just ignore it in the event handler. Is there any recommended solution for now?

Also, are there any plans on having EventAdapter[List[Event], Any]? I can try to make a contribution with it if I get some guidance.


Hi @michaltomanski,

I think that this may be an oversight. The behavior should be compatible with previous untyped version.

I suggest you to raise an issue on the Akka repo in GitHub.



Hi @octonato,

Thanks for the reply. Issue created here ->