I'm working through a basic example of working with NEventStore with RavenDB and I've hit a stumbling block.
I've managed to succesfully commit my events to the RavenDB datasource, but now I need to pull them back out, to replay them (CQRS - ES) pattern.
I can bring back the Collection of EventMesssage objects by usng the NEventStore IStoreEvents Unterface like this :-
public IEnumerable<EventMessage> GetEvents(Guid aggregateRootId)
{
using (var stream = _store.OpenStream(aggregateRootId, 0))
{
return stream.CommittedEvents;
}
}
In each EventMessage, I can access the Header & the Body Properties. In the body property is the actual event that i have submitted, which i want to pull out and inspect.
I'm not sure if what I'm trying to achieve is correct.
Should I be using the Raven IDocumentStore class to retrieve the event objects or should this be done via NEventstore Stream.