akka-blog-example icon indicating copy to clipboard operation
akka-blog-example copied to clipboard

Multi Entity Commands

Open two10 opened this issue 6 years ago • 1 comments

Hello,

I am new to Event Sourcing and CQRS.

In the example if i have a command which says merge two blog and make a new blow which constains all posts of blog 1 and blog 2 and mark other two blogs as defunct.

In this kind of scenario, how should i implement Event Sourcing and CQRS and maintain consistency

two10 avatar Oct 03 '17 06:10 two10

Using the style from the example here, you may wish to consider making a specific command object for your use case which generates multiple events. The main source of consistency in event sourcing is by strict validation of commands before generating events from them.

Overall, maintaining consistency in event sourcing revolves around ensuring that only valid events are generated. If you need to roll back data, though, you can generally handle this by creating compensating transactions.

jvz avatar Oct 03 '17 14:10 jvz