We are currently building a CQRS micro-service for a Time & Attendance project. Our solution models Timecards to capture events like clock-in and clock-out. As a CQRS solution, we are also building read-side processors by hand using Akka Persistence and the akka-persistence-cassandra plugin, as we have not yet made the decision to move to Lagom.
The root of our problem
- We want to be able to build each read-side Processor as a Persistent Actor in the cluster so that new Views play all the tagged events from the beginning of time.
- If the schema for a given View evolves, we want to be able to truncate the Offset events for that view so that we can modify the View, and then replay all messages from the beginning of time, so that the modified View is up to date.
- Akka Persistence and akka-persistence-cassandra, out of the box, creates a “messages” table (along with the supporting tag_view, etc tables). All the messages for all Persistent Actors are in that one table.
- Is there a way to create multiple instances of the akka-persistence-cassandra plugin and custom configure them, so that there are multiple “messages” tables with unique names?
- We would want one messages table for the write-side events that would hold all the messages for all the Timecards. So, just one table to hold all the write-side events.
- Then we would want one “messages” table per read-side Processor, so that the Offsets for each Processor have their own table. This way, each Processor can be replayed from the beginning to rebuild a given View independently of the others, simply by truncating its Offset event messages table.