How do I introduce a new event denormalizer in a CQRS system?
cqrs
Solution
You can fetch and replay all (required) events against the new handler. This can be done in a separate process since what you essentially want is to get the persisted view models into the proper state.
Have a look at Rinat Abdullin's Lokad.CQRS sample project for a production example. Especially the `SaaS.Engine.StartupProjectionRebuilder` might be an interesting source even though it's rather complex.
Problem
According to CQRS à la Greg Young, event handlers (and the downstream event denormalizers) react on incoming events that were published before by the event publisher. Now lets suppose that at runtime we want to add a new event denormalizer: Basically, this is easy, but it needs to get to its data to the current state. What is the best way to do this? Should I send an out-of-order request to the event store and ask for all previously emitted events? Or is there a better way to do this?