DevArchive.net Blog

Thursday, December 1, 2016

Comparing DDD + ES + CQRS with DDD without ES, CQRS

When using DDD with ES, CQRS, events are used in four ways:

1) they are used to reconstitute aggregate state
2) they are used to build read model
3) they are used to drive back-end workflows
4) they can be used as audit log
The flow of events in ES model is:
You can use standard approach of working with tables representing state of aggregates, or whatever persistence approach is in place,
But still want to use last two advantages of events:
3) they are used to drive back-end workflows
4) they can be used as audit log

So you can design the system as follows:
Here event log can be used as audit trail, and sagas can be driven by events,
You can also archive events from event log periodically, thus you don't need anymore to store all events all the time