0
CQRS Races Sagas
Domain
Model
Get dataGet data
Change dataUser is looking at
stale data
Data correct as of
10 minutes ago
List of customers
List of customers
Customer Service Rep view
ID Name Phone
List of customers
Supervisor view
ID Name Phone Lifetime value
Queries
Commands
DB
Service
Layer
Input
Validation Validation
Rules
Queries
View Model
View Model
Updater
Publish
Client
Cancel OrderShip Order
Rules:
1. Cannot cancel shipped orders
2. Don’t ship cancelled orders
public class Order
{
public void Cancel()
{
if (status != OrderStatusEnum.Shipped)
//cancel
}
public void Ship()
{
if (sta...
Looks like we’re stuck
The customer doesn’t want the products
No point in arguing
Rules:
1. Cannot cancel shipped orders
Because shipping costs money
That money would be lost if the customer cancelled
Bec...
www.NServiceBus.com
Queries
Commands
DB
Service
Layer
Input
Validation Validation
Rules
Queries
View Model
View Model
Updater
Publish
Client
CQRS Races Sagas
Domain
Model
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Cqrs race conditions_and_sagas_ohmy
Upcoming SlideShare
Loading in...5
×

Cqrs race conditions_and_sagas_ohmy

5,302

Published on

Published in: Technology, News & Politics
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,302
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
68
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide
  • This is a fact of life – like gravity – you can’t fight it.
  • We see this on Twitter and Facebook – telling us how long ago something happened
  • Don’t need all data in the DB or in the rules – what needs to be in there?
  • If a use clicked a button a microsecond earlier or later, that shouldn’t change fundamental business objectives.
  • Race conditions will cause many commands to fail, undoing much of the foundation of CQRS
  • Which indicates that there’s a bug in the requirements
  • Transcript of "Cqrs race conditions_and_sagas_ohmy"

    1. 1. CQRS Races Sagas Domain Model
    2. 2. Get dataGet data Change dataUser is looking at stale data
    3. 3. Data correct as of 10 minutes ago List of customers
    4. 4. List of customers Customer Service Rep view ID Name Phone List of customers Supervisor view ID Name Phone Lifetime value
    5. 5. Queries Commands DB Service Layer Input Validation Validation Rules Queries View Model View Model Updater Publish Client
    6. 6. Cancel OrderShip Order Rules: 1. Cannot cancel shipped orders 2. Don’t ship cancelled orders
    7. 7. public class Order { public void Cancel() { if (status != OrderStatusEnum.Shipped) //cancel } public void Ship() { if (status != OrderStatusEnum.Cancelled) //ship } }
    8. 8. Looks like we’re stuck
    9. 9. The customer doesn’t want the products No point in arguing
    10. 10. Rules: 1. Cannot cancel shipped orders Because shipping costs money That money would be lost if the customer cancelled Because we refund the customers money 2. Don’t ship cancelled orders
    11. 11. www.NServiceBus.com
    12. 12. Queries Commands DB Service Layer Input Validation Validation Rules Queries View Model View Model Updater Publish Client
    13. 13. CQRS Races Sagas Domain Model
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×