Replay EventStore

Skip to first unread message

Marco Franssen

May 2, 2011, 9:11:34 AM5/2/11
to ncqrs-dev
I changed my Readmodels and Denormalizers, now I want to fill my
readmodels again.

How can I replay my EventStore so my Readmodels are filled again with
the data?

Pieter Joost van de Sande

May 2, 2011, 10:01:37 AM5/2/11
We support a Async Event Bus. You can reset the cursor for your specific Read Model (event handler) to replay the events.


May 3, 2011, 8:46:12 AM5/3/11
to ncqrs-dev
Please could you elaborate? I am fairly new to this framework and am
unsure how resetting a cursor (which is where?) would trigger a
repopulation, regardless of the synchronicity of the eventing.
Sorry :)

On May 2, 3:01 pm, Pieter Joost van de Sande <>
> We support a Async Event Bus. You can reset the cursor for your specific
> Read Model (event handler) to replay the events.


May 3, 2011, 2:41:58 PM5/3/11
to ncqrs-dev
I believe Pieter is talking about the CursorPositionCalculator class
utilizing a 'restarting' of sequences. What I'd like to know also is
do we have to reset the sequences in the (in this case I'm using SQL
Server) the Events or EventStore table? Is that necessary? If so,
what procedure do we need to 'set' to have the framework 'start' the
replaying of events?

> > > the data?- Hide quoted text -
> - Show quoted text -


May 3, 2011, 2:52:32 PM5/3/11
to ncqrs-dev
Also, Pieter, are you assming we're using the 'Pipeline' and a
'browsable' element store?
> > - Show quoted text -- Hide quoted text -


May 19, 2011, 11:03:08 AM5/19/11
to ncqrs-dev

Have spent a while answering other questions around the new
application I'm building but this one is still the elephant in the

As I'm using convention to ensure events reach the correct
denormalisers, etc., at what point should I be thinking about touching
the event store itself, i.e. the CursorPositionCalculator, etc., which
at the moment I don't have to care about at all?

Is it linked to the snapshot feature at all? I have been updating
aggregates merrily and not one has ever created a snapshot record, I
was (naively?) assuming that this kind of behaviour would have some
sort of default behaviour as it's not immediately clear at which point
I would intervene to force snapshot (memento?) creation.

As far as I can tell, I'm going to have to create some sort of
additional application to replay all events or is there other 'auto'
behaviour which I might be missing?


May 19, 2011, 4:34:23 PM5/19/11
to ncqrs-dev
You basically replay all events needed for your given projections. How
you do that is ncqrs specific.


May 20, 2011, 5:35:15 AM5/20/11
to ncqrs-dev
'Ncqrs specific' - there, I guess, lies my question!

On the snapshot issue, I can see the DomainRepository has the
capability to take a snapshot but I use the MsSqlServerEventStore and
never go anywhere near the repository. This is a specific
implementation question I think but what are the options? As an
outsider to the project I cannot find any information to let me know
what is contained within ncqrs and for what purpose each object should
be used.

For the event replay, yes I understand I need to replay the events and
I think from my chosen implementation (synchronous, in-process,
command exceptions trickling up to interface level, merely taking
advantage of command/query separation and event store) I will need to
create a new application of some description to handle the rebuild,
which in turn raises questions about on/offline, etc. but how do I go
about getting hold of the events in the first place?

There seems to be a gulf between the information available to get up
and running (very informative, btw) and the information required for
more advanced implementation details. I would be happy to assist in
collating some of this information but would definitely need help in
understanding these features better. Please let me know any
information you have!


Aug 3, 2011, 8:55:37 PM8/3/11
Did this ever get a useful response?

I am beginning my initial spikes and have worked through the samples and have basics up and running. Commands, events, denorms, snapshots. Basic UI Frontend. The system is easy to use, everything seems clear if you are used to the concepts.
Events are going to the store, data is denormalized as required.

The next thing is to re-run the old events into a new read model data store.

I imagine most people are going to want to do this pretty early on. There doesn't seem to be any example of how to replay the already existing events, with and without snapshots, and apply whatever denorms I want.

Specifically for me, the read model tables are entity framework code first based and get re-created each time I adjust the model, so they need to be repopulated.

Would someone out there please stick up a quick method body showing how to do this? I imagine with existing stores, read models, denorms, it's about 10 lines of code. I can further constrain that the event order would likely be the creation order, and all event types would be available and need to be played.


Aug 4, 2011, 10:05:56 AM8/4/11
to ncqrs-dev
I did it using the MSSQL event store and NServiceBuse by reading each
event back in and publishing it to NService bus. Outside of that,
I've not tried it using the Non NServiceBus -- that would be different
for sure...


Oct 3, 2013, 12:23:02 PM10/3/13
I see some time has passed since this posts where placed but I want to help anyone who need it.
I've published sample code with my readmodel rebuilder.
It has some contextual code (the project I've been working on), but I guess is pretty easy to adapt it and use it
Hope this help

Greg Young

Oct 3, 2013, 1:11:45 PM10/3/13
This means you need a control channel. This is generally a bad way of doing things. Use a client controlled not a producer controlled subscription. Neventstore supports this as of v5 (think atom feed()
Le doute n'est pas une condition agréable, mais la certitude est absurde.
Reply all
Reply to author
0 new messages