One of the point of CQRS that has been brought up many times, is the ability to replay events in order to fill a new projection. Are the any examples showing how this works? The documentation talks about it vaguely, and I’ve seen the simple cqrs example project, but I’m not seeing any examples of these concepts using EventStore. I have a few ideas, but many of them seem to overlap which worries me, so I’d rather ask for a practical example. I’m working in .Net. I’d like to see how the following things work so that I can adopt it:
- Denormalizers sitting on my query side waiting for events to come in so that they can be persisted to the db
- Subscribing to these events by category because I don’t think subscribing to Account-1234 is useful. I need to subscribe to Account-*
- Which subscription type should I use for something like this? Persistent? Volatile?
- Creating a new projection that will be stored in my query db
- I thought I would just have to create a new structure to be saved on the query side and use the event data to build it, but should I use the build in projections functionality or either way fine?
- Replaying events for a category so that the new projection (or simple denormalized view) can be filled.
- How would I do this in a production environment? Do I need to write a utility for this? How would you make it a one time operation?
And then some other questions
- I’m using NServiceBus. Should I treat events on the bus separate of events on the event stream? I thought maybe there wouldn’t be a case where an event occurred that wasn’t the result of a command (resulting in an event on the event store), but Sagas use events in to track each step of a long running process. It seems like I should keep them separate which should also simplify the need to share event objects.