Reputation:
Implementing/handling idempotency in c# with Jolivers EventStore. Does this mean just taking care of checking an aggregate ID and version alongside the domain/readmodel before handling? Or is there more to it than that?
[EDIT]
The reason I'm asking is that I, for instance, want to develop my app in small feature chunks.
so - imagine I have a dataset of some type with product data for an online store. I want to start developing the app by creating the ability to search for products. this means importing the dataset somehow (doesn't matter how). each product in the dataset eventually fires (for example) a CreateProductCommand - this command goes through the domain which fires the ProductAddedEvent which is then handled by a denormalizer to populate the ProductSearchView
Now - after the search feature is implemented, I want to create the product detail views. I have already ran the import to get the dataset into the system so I want to re-run the events which will fire off the denormalizers to populate the ProductDetailView
Does that make sense?
Upvotes: 1
Views: 1772
Reputation: 17156
What you can do is to clean the read model data store and run all the events in the Event Store using the same mechanisms you would use when they were first published.
I am using a separate thing to do this as a step in my deployment process.
Using an instance of the Event Store I get all events from the beginning of time:
var commits = eventStore.Advanced.GetFrom(DateTime.MinValue).ToList();
Then I iterate over the list and dispatch the events to the read model using much of the same code I use when they are normally dispatched.
That's basically it.
What you should do is to create something that makes this simple for you because you will have to do this a lot.
Upvotes: 3