I’m wondering if someone has done this or thought about a good approach. I’m thinking serialization both for the purpose of persistence and intra-cluster communication.
My usual approach would be to use a tool that generates the case classes based on the protobuf source, using e.g. https://github.com/thesamet/sbt-protoc. In any instance I don’t want to have to serialize by hand.
Using this approach I would then select different base traits for commands / events of each actor - the traits would be defined in code most likely, whereas the selection can be done by feeding an option (for each message) to scalapb.
What’s bugging me a bit is how to best go with regards to namespacing. Using companion objects isn’t an option with generated classes (I think) and so I’d either have to settle for one big flat namespace (meh) or something odd such as one package per actor.