Different serialization for each PersistenceId

I’m using akka-persistence-cassandra and akka-kryo-serialization.I’ve multiple persistence ids and they use kryo serialization. For my new persistence id I want to use different serialization for example protobuf. Is it possible?

Cassandra uses the serialization infrastructure of Akka, and includes the serializer identifier, which means that if you configure a new serializer from some point in time, the old events will still be de-serializable (as long as you keep that old serializer impl around and do not mess with the serializer id config).

I can’t think of a way you could selectively choose serializer based on the persistence id though, the serializer is chosen based on the type of the event, and unless you include the persistence id in your events it won’t be available to the serialization infrastructure (same goes for EventAdapters)

1 Like