Skip to content

Episode 28 – Learning Lokad CQRS

2013 April 24
by Kerry Street
Share

Kerry and Rinat dig into the Lokad CQRS project that laid the code foundation for their current projects. This open source sample provides a working slice of a production system’s registration and user management subdomains that were implemented with Aggregates and Event Sourcing. While they get into the details of its multi-Aggregate implementation, they cover the communication and workflow between these aggregates, how data storage and querying is achieved, and even get into some authentication and authorization options.

Download (mp3): Episode 28 – Learning Lokad CQRS – (49 minutes)

Subscribe via RSS | Subscribe for free in iTunes

Episode References:

What do you think?

One Response Post a comment
  1. June 9, 2013

    I was using Entity Framework 5.0 with DDD principles to develop a .net app. It is an n-layer application with distributed service, app service and domain service etc… I changed the direction to use CQRS so I can use this app in a distributed environment. I’m excited about LOKAD CQRS.

    There is one area I really struggle with which is the aggregate validation and the business rule evaluation. In the example that you presented, let us take a business rule evaluation ‘Do not allow the customer to create an account if he has already been registered before and has a balance amount to pay. If the user has no balance, allow to active his previous account.’

    I approach this problem this way. This business evaluation needs to be done in the method ‘public void Create(UserId userId, SecurityId securityId)’ before ‘UserCreated’ event is Applied. I may use a synchronous call to do the business rule evaluation. But let us look at a problem here.

    Let us assume the credit information comes from a different Bounded Context called Credit. To solve this, the UserAggregate has to send an event to the Credit Bounded Context to check the credit. Is this a right approach? How the UserAggregate coordinate with a different aggregate in a different Bounded Context to achieve the business rule evaluation? How do we prevent the creation of the user? Doesn’t this mean we have to cancel all the subsequent events after the CreateUser command?

    There is a lot of guidance on Commands, Events in CQRS but less on Validation. I appreciate your feedback on the problem I described as well as some general guidance on the business rule evaluation.

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS