Ever since attending Greg Young’s Unshackle Your Domain talk at QCon ’08 in San Francisco and a later two-day training course given by Greg Young I’ve wanted to build a sample application that made use of the principles of Command-Query Responsibility Separation (CQRS).

However, other interesting things intervened and I never got around to doing this.

But every few months we have a one day internal training course at Xebia Software Development and after Sjors Grijpink and I proposed to give a training on DDD and CQRS we got some time to actually prepare and implement a CQRS example application.

The Xebia Lottery

The application is fairly simple (as it should be for a one day training course) but touches on all the major components needed for a full-blown CQRS implementation.

CQRS components

The source code for the training exercises can be found at github. There are three branches:

  1. exercise – the code used for doing the training exercises.
  2. solution – the same code as above but with the solutions added.
  3. master – the main development branch, currently used to implement more advanced features like snapshotters, command-event conflict resolution, historical tracing, etc.

The Xebia ITR CQRS presentation is also available.

All-in-all the training was a success and I think that the basic CQRS principles are the way forward when you need to build enterprise applications with a complicated domain logic or strong auditing or historical tracing requirements.

Do you want to know more about this subject?
Look at our consultancy services, training offers and careers below or contact us at info@xebia.com