Reputation: 3186
I'm trying out Akka persistence with CQRS in mind. On my Write side, I've the entity like
case class Evt(data:String)
My persist code looks like
persist(Evt(s"${data}"))
All works on the write side.
I'm using Redis journal plugin.
When I attempt to read the journal entry on the Read side, its looking for the class WriteModel.Evt and seeing below error
[akka.dispatch.Dispatcher] WriteModel.Evt java.lang.ClassNotFoundException: WriteModel.Evt
Am I persisting the event appropriately?
What is the best practice to share the contact between Write and Read/Aggregator side ?
Upvotes: 0
Views: 52
Reputation: 7275
At first, you need to decide what serialization format/protocol to use.
Akka persistence works out-of-box with Java serialization, which is good for a fast prove of concept but not for production systems. You could chose from protobuf, avro and even json. The are plenty of serialization protocols to chose from. Check this out.
Depending on this, you make your choice how to share the schemas in case of protobuf or avro.
Additionally, you have to implement your own event serializer or use default serializer. And consider how to manage future event schema evolution.
All of this eventually dictates how to share and manage your event schema.
Upvotes: 0