Actually, I like Scott Reynolds suggestion that aggregate roots don't
need to keep a list of any events, only the current state and the unit
of work should track un-committed events (see
http://groups.google.com/group/ncqrs-dev/msg/8581b6ee26180299 ). I
think this is also similar to Mark Nijhof's example where the bus
stores the events and the bus has a Commit method.
With NCQRS we already have an event that fires when an event is
applied, the unit of work could hook this event to maintain a list of
un-committed events.
On Jul 14, 8:06 pm, Szymon Pobiega <
szymon.pobi...@gmail.com> wrote:
> I thought about a solution where AggregateRoot maintains a collection of
> pending (not saved) events. This collection would be persisted by its
> repository when saving.
>
> My point was also that why bother having cqrs and event sourcing when we
> don't enforce asynchronous communication between aggregates? All we get in
> this case is audit log (event stream). Thre true power of cqrs and event
> sourcing (performance) comes from asynchronous communication between
> aggregates and if we do it, unit of work is not necessary.
>
> Yes, saving multiple events coming from single command should be
> transactional. As for publishing to bus -- it depends. 'bus' can be as
> simple as Atom feed built on top of event store. In that case publishing to
> bus is trivial and does not need transactions.
>
> Szymon
>
> 2010/7/14 Chris Chilvers <
chilve...@googlemail.com>