CQRS
by Michael Schnell
1. Command
1.1. Example: RelocateCustomerCommand
1.2. Is immutable (when using Messaging Pattern)
1.3. Is a method call (When not using the Messaging Pattern)
1.4. Execution may fail (with an exception)
1.5. QUESTION: Should value objects be used in commands?
2. Command Handler
2.1. Handles one or more commands
2.2. May refuse to execute the command by throwing an exception
3. Workflow
3.1. Called Saga by Greg Young
3.2. Listens to events
3.3. Sends Commands & Events
3.4. Business Process Model and Notation (BPMN)
3.5. Saga vs. State Machine vs. Workflow (Kelly Sommers)
4. Event
4.1. Is immutable
4.2. Named with a verb in the past tense
4.3. Example: CustomerRelocatedEvent
4.4. Never fails (as it already happened)
5. Related concepts
5.1. Messaging Pattern
5.2. Event Sourcing
5.2.1. storing current state as a series of events
5.2.2. Rebuild state by replaying series of events
5.2.3. Snapshots for better performance
5.3. Design by contract (DBC)
5.4. Eventual Consistency
5.4.1. CAP theorem
5.5. Task Based UI
5.5.1. Decomposing CRUD to a Task Based UI
5.6. Behavior-driven development (BDD)
5.6.1. "Given-When-Then" style tests
5.6.2. Natural fit for CQRS/ Event Sourcing
5.6.3. Introducing BDD (Dan North)
5.7. Fast Command Bus
5.7.1. The LMAX Architecture (Martin Fowler)
5.7.2. Disruptor
5.7.3. Processing 1M commands per second with Axonframework
6. Based on "Command Query Separation" (CQS) idea from Betrand Meyer
7. Projector
7.1. Listens for events
7.2. Creates and manages views
7.3. Projects incoming events to a view
8. View
8.1. A representation of the system for a special purpose
8.2. Could also be another model like an UML diagram, a Java class, Excel file, XML file or a chart
8.3. Query
8.3.1. Is based on a view
8.3.2. Stateless
8.3.3. Similar to a function (See DDD Map)