I’m currently trying to implement encryption of persisted events in my application. I’ve read the docs on creating custom serializers here: https://doc.akka.io/docs/akka/current/serialization.html but there is no information on how or what creates new serializer instances or how transient they are (does an actor system only ever create one instance per type or does it have a pool of them?).
I’m currently working on the assumption that a custom serializer implementation can not be passed anything other than a ExtendedActorSystem parameter (though if I could pass in other parameters it would be a big help).
So my current implementation required the serializer to look-up an actor ref and message an actor to retrieve the correct encryption key. This though leads me to have to use the Await construct as the toBinary and fromBinary methods are synchronous.
I’m using the akka-peristence-dynamo plugin, no support in main branch for AsyncSerializer atm but there is an active pull request for an implementation https://github.com/akka/akka-persistence-dynamodb/pull/80 so there is still hope for me!