cqrs - NEventStore RavenDB - Obtain Commit Data -
i'm working through basic example of working neventstore ravendb , i've hit stumbling block.
i've managed succesfully commit events ravendb datasource, need pull them out, replay them (cqrs - es) pattern.
i can bring collection of eventmesssage objects usng neventstore istoreevents unterface :-
public ienumerable<eventmessage> getevents(guid aggregaterootid) { using (var stream = _store.openstream(aggregaterootid, 0)) { return stream.committedevents; } }
in each eventmessage, can access header & body properties. in body property actual event have submitted, want pull out , inspect.
i'm not sure if i'm trying achieve correct.
should using raven idocumentstore class retrieve event objects or should done via neventstore stream.
at basic level you're doing correct: it's same code shown in quick-start neventstore sample code. if work in more ddd context, should emit events aggregates using commondomain library embedded in neventstore, , retrieve them irepository interface.
you find example in web. 1 of them training project: https://github.com/williamverdolini/cqrs-es-todos (some notes that). i'm not using ravendb , i'm still learnig...but useful ;-)
Comments
Post a Comment