SlideShare une entreprise Scribd logo
1  sur  21
Christopher Bennage
Microsoft
Exploring CQRS and Event Sourcing
A journey into high scalability, availability, and maintainability with Windows Azure
Terminology
What is CQRS?
Separating Reads from Writes



Command
Query
Responsibility
Segregation

 An architectural pattern that separates
 Commands, that change state, from Queries that
 only read state.
Simple Example of CQRS
Segregating Queries


                                         Presentation

                         Validation                     Queries (generate DTOs)

                        Commands

                       Domain Logic

                      Data persistence




                                                                                                               Based on Rob Ashton’s
                                                                                  codeofrob.com/entries/cqrs-is-too-complicated.html
Taking it further…
Separate Data Stores


                                          Presentation

                          Validation                     Queries (generate DTOs)

                         Commands

                        Domain Logic

                       Data persistence
What is Event Sourcing?
An Alternate Way to Represent the Data


 Relational Model




 Event Stream

                                                                Shipping
                                                     Item 1
   Cart Created     Item 1 Added     Item 2 Added             Information
                                                    Removed
                                                                 Added
CQRS / ES

                               Presentation

               Validation                     Read thin-layer

              Commands

             Domain Logic

            Data persistence




                                                                                             Based on Rob Ashton’s
                                                                codeofrob.com/entries/cqrs-is-too-complicated.html
Eventual Consistency
 The Trade-Off



• Asynchronous is faster, but may yield stale data

• Write Model can be consistent

• Write Model is the source of truth
a CQRS Journey
“For the things we have to
learn before we can do them,
we learn by doing them.”
                     ~Aristotle
Project Objectives



• Build Consensus
• Focus on Learning
• Leverage Windows Azure
Decomposing the Domain



    Conference     Discounts    Orders &
    Management                 Registrations




                                Payments
demo >> conference management system
When to Use CQRS?

•   Do multiple users compete for access to the same resources?

•   Are the business rules ever changing?

•   Is scalability one of the challenges?

•   Is the business logic complex?

•   Are benefits that CQRS brings clear?
Benefits
CQRS & Event Sourcing


•   Integration with other systems / screens

•   Versioning / Evolution

•   Team development

•   Testing

•   Performance can be fine-tuned separately
Some Lessons Learned

•   Throw away your assumptions

•   CQRS space is a little confusing - inconsistency, dissonance

•   Not a top-level architecture

•   Not everything needs to be asynchronous, nor message-based

•   In messaging, tracing matters big time

•   Test for performance early

•   Find or build a robust infrastructure that fits your needs

•   “Sagas” != sagas; Avoid them at first
Questions?
Resources
microsoft.com/practices


Project                    Personal
• cqrsjourney.github.com   • @bennage
• aka.ms/cqrs              • dev.bennage.com
• aka.ms/cqrspdf
Exploring CQRS and Event Sourcing

Contenu connexe

Similaire à Exploring CQRS and Event Sourcing

Cloud Architecture Patterns for Mere Mortals - Bill Wilder - Vermont Code Cam...
Cloud Architecture Patterns for Mere Mortals - Bill Wilder - Vermont Code Cam...Cloud Architecture Patterns for Mere Mortals - Bill Wilder - Vermont Code Cam...
Cloud Architecture Patterns for Mere Mortals - Bill Wilder - Vermont Code Cam...Bill Wilder
 
Europe Virtual ALT.NET - EventStore v3
Europe Virtual ALT.NET - EventStore v3Europe Virtual ALT.NET - EventStore v3
Europe Virtual ALT.NET - EventStore v3Jonathan Oliver
 
CodeFest 2014. Christopher Bennage — CQRS Journey: scalable, available, and m...
CodeFest 2014. Christopher Bennage — CQRS Journey: scalable, available, and m...CodeFest 2014. Christopher Bennage — CQRS Journey: scalable, available, and m...
CodeFest 2014. Christopher Bennage — CQRS Journey: scalable, available, and m...CodeFest
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architectureandreaskallberg
 
Event Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveEvent Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveJonas Bonér
 
Webinar issues we_find_slideshare
Webinar issues we_find_slideshareWebinar issues we_find_slideshare
Webinar issues we_find_slideshareSOASTA
 
AWS Summit 2011: Architecting in the cloud
AWS Summit 2011: Architecting in the cloudAWS Summit 2011: Architecting in the cloud
AWS Summit 2011: Architecting in the cloudAmazon Web Services
 
The Cloud: A game changer to test, at scale and in production, SOA based web...
The Cloud: A game changer to test, at scale and in production,  SOA based web...The Cloud: A game changer to test, at scale and in production,  SOA based web...
The Cloud: A game changer to test, at scale and in production, SOA based web...Fred Beringer
 
20141021 AWS Cloud Taekwon - Startup Best Practices on AWS
20141021 AWS Cloud Taekwon - Startup Best Practices on AWS20141021 AWS Cloud Taekwon - Startup Best Practices on AWS
20141021 AWS Cloud Taekwon - Startup Best Practices on AWSAmazon Web Services Korea
 
Planning the Migration to the Cloud - AWS India Summit 2012
Planning the Migration to the Cloud - AWS India Summit 2012Planning the Migration to the Cloud - AWS India Summit 2012
Planning the Migration to the Cloud - AWS India Summit 2012Amazon Web Services
 
Imaginea Performance Engineering
Imaginea Performance EngineeringImaginea Performance Engineering
Imaginea Performance EngineeringRajaneeshChandra
 
Take the spaghetti out of windows azure – an insight for it pro techies part 2
Take the spaghetti out of windows azure – an insight for it pro techies part 2Take the spaghetti out of windows azure – an insight for it pro techies part 2
Take the spaghetti out of windows azure – an insight for it pro techies part 2Microsoft TechNet - Belgium and Luxembourg
 
Cloud architecture and deployment: The Kognitio checklist, Nigel Sanctuary, K...
Cloud architecture and deployment: The Kognitio checklist, Nigel Sanctuary, K...Cloud architecture and deployment: The Kognitio checklist, Nigel Sanctuary, K...
Cloud architecture and deployment: The Kognitio checklist, Nigel Sanctuary, K...CloudOps Summit
 
Governing and managing hybrid SharePoint environments
Governing and managing hybrid SharePoint environmentsGoverning and managing hybrid SharePoint environments
Governing and managing hybrid SharePoint environmentsRandy Williams
 

Similaire à Exploring CQRS and Event Sourcing (20)

Cloud Architecture Patterns for Mere Mortals - Bill Wilder - Vermont Code Cam...
Cloud Architecture Patterns for Mere Mortals - Bill Wilder - Vermont Code Cam...Cloud Architecture Patterns for Mere Mortals - Bill Wilder - Vermont Code Cam...
Cloud Architecture Patterns for Mere Mortals - Bill Wilder - Vermont Code Cam...
 
Europe Virtual ALT.NET - EventStore v3
Europe Virtual ALT.NET - EventStore v3Europe Virtual ALT.NET - EventStore v3
Europe Virtual ALT.NET - EventStore v3
 
The Art of CQRS
The Art of CQRSThe Art of CQRS
The Art of CQRS
 
CodeFest 2014. Christopher Bennage — CQRS Journey: scalable, available, and m...
CodeFest 2014. Christopher Bennage — CQRS Journey: scalable, available, and m...CodeFest 2014. Christopher Bennage — CQRS Journey: scalable, available, and m...
CodeFest 2014. Christopher Bennage — CQRS Journey: scalable, available, and m...
 
Azure and cloud design patterns
Azure and cloud design patternsAzure and cloud design patterns
Azure and cloud design patterns
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
 
Event Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveEvent Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspective
 
Lets focus on business value
Lets focus on business valueLets focus on business value
Lets focus on business value
 
Extending your data to the cloud
Extending your data to the cloudExtending your data to the cloud
Extending your data to the cloud
 
Webinar issues we_find_slideshare
Webinar issues we_find_slideshareWebinar issues we_find_slideshare
Webinar issues we_find_slideshare
 
AWS Summit 2011: Architecting in the cloud
AWS Summit 2011: Architecting in the cloudAWS Summit 2011: Architecting in the cloud
AWS Summit 2011: Architecting in the cloud
 
The Cloud: A game changer to test, at scale and in production, SOA based web...
The Cloud: A game changer to test, at scale and in production,  SOA based web...The Cloud: A game changer to test, at scale and in production,  SOA based web...
The Cloud: A game changer to test, at scale and in production, SOA based web...
 
20141021 AWS Cloud Taekwon - Startup Best Practices on AWS
20141021 AWS Cloud Taekwon - Startup Best Practices on AWS20141021 AWS Cloud Taekwon - Startup Best Practices on AWS
20141021 AWS Cloud Taekwon - Startup Best Practices on AWS
 
Boxcar computing
Boxcar computingBoxcar computing
Boxcar computing
 
Planning the Migration to the Cloud - AWS India Summit 2012
Planning the Migration to the Cloud - AWS India Summit 2012Planning the Migration to the Cloud - AWS India Summit 2012
Planning the Migration to the Cloud - AWS India Summit 2012
 
Imaginea Performance Engineering
Imaginea Performance EngineeringImaginea Performance Engineering
Imaginea Performance Engineering
 
So Many Docker Platforms...so little time
So Many Docker Platforms...so little timeSo Many Docker Platforms...so little time
So Many Docker Platforms...so little time
 
Take the spaghetti out of windows azure – an insight for it pro techies part 2
Take the spaghetti out of windows azure – an insight for it pro techies part 2Take the spaghetti out of windows azure – an insight for it pro techies part 2
Take the spaghetti out of windows azure – an insight for it pro techies part 2
 
Cloud architecture and deployment: The Kognitio checklist, Nigel Sanctuary, K...
Cloud architecture and deployment: The Kognitio checklist, Nigel Sanctuary, K...Cloud architecture and deployment: The Kognitio checklist, Nigel Sanctuary, K...
Cloud architecture and deployment: The Kognitio checklist, Nigel Sanctuary, K...
 
Governing and managing hybrid SharePoint environments
Governing and managing hybrid SharePoint environmentsGoverning and managing hybrid SharePoint environments
Governing and managing hybrid SharePoint environments
 

Plus de Christopher Bennage

Modern Cloud Fundamentals: Misconceptions and Industry Trends
Modern Cloud Fundamentals: Misconceptions and Industry TrendsModern Cloud Fundamentals: Misconceptions and Industry Trends
Modern Cloud Fundamentals: Misconceptions and Industry TrendsChristopher Bennage
 
Performance optimization and Cloud applications
Performance optimization and Cloud applicationsPerformance optimization and Cloud applications
Performance optimization and Cloud applicationsChristopher Bennage
 
Semantic Logging: Avoiding the Logging Chaos
Semantic Logging: Avoiding the Logging ChaosSemantic Logging: Avoiding the Logging Chaos
Semantic Logging: Avoiding the Logging ChaosChristopher Bennage
 
Windows 8 JavaScript (Wonderland)
Windows 8 JavaScript (Wonderland)Windows 8 JavaScript (Wonderland)
Windows 8 JavaScript (Wonderland)Christopher Bennage
 
Getting Started with Test-Drive Development
Getting Started with Test-Drive DevelopmentGetting Started with Test-Drive Development
Getting Started with Test-Drive DevelopmentChristopher Bennage
 

Plus de Christopher Bennage (8)

Modern Cloud Fundamentals: Misconceptions and Industry Trends
Modern Cloud Fundamentals: Misconceptions and Industry TrendsModern Cloud Fundamentals: Misconceptions and Industry Trends
Modern Cloud Fundamentals: Misconceptions and Industry Trends
 
Azure Reference Architectures
Azure Reference ArchitecturesAzure Reference Architectures
Azure Reference Architectures
 
Performance optimization and Cloud applications
Performance optimization and Cloud applicationsPerformance optimization and Cloud applications
Performance optimization and Cloud applications
 
Semantic Logging: Avoiding the Logging Chaos
Semantic Logging: Avoiding the Logging ChaosSemantic Logging: Avoiding the Logging Chaos
Semantic Logging: Avoiding the Logging Chaos
 
Windows 8 JavaScript (Wonderland)
Windows 8 JavaScript (Wonderland)Windows 8 JavaScript (Wonderland)
Windows 8 JavaScript (Wonderland)
 
Source Control Concepts
Source Control ConceptsSource Control Concepts
Source Control Concepts
 
An Introduction to WPF
An Introduction to WPFAn Introduction to WPF
An Introduction to WPF
 
Getting Started with Test-Drive Development
Getting Started with Test-Drive DevelopmentGetting Started with Test-Drive Development
Getting Started with Test-Drive Development
 

Dernier

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Dernier (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Exploring CQRS and Event Sourcing

  • 2. Exploring CQRS and Event Sourcing A journey into high scalability, availability, and maintainability with Windows Azure
  • 4. What is CQRS? Separating Reads from Writes Command Query Responsibility Segregation An architectural pattern that separates Commands, that change state, from Queries that only read state.
  • 5. Simple Example of CQRS Segregating Queries Presentation Validation Queries (generate DTOs) Commands Domain Logic Data persistence Based on Rob Ashton’s codeofrob.com/entries/cqrs-is-too-complicated.html
  • 6. Taking it further… Separate Data Stores Presentation Validation Queries (generate DTOs) Commands Domain Logic Data persistence
  • 7. What is Event Sourcing? An Alternate Way to Represent the Data Relational Model Event Stream Shipping Item 1 Cart Created Item 1 Added Item 2 Added Information Removed Added
  • 8. CQRS / ES Presentation Validation Read thin-layer Commands Domain Logic Data persistence Based on Rob Ashton’s codeofrob.com/entries/cqrs-is-too-complicated.html
  • 9. Eventual Consistency The Trade-Off • Asynchronous is faster, but may yield stale data • Write Model can be consistent • Write Model is the source of truth
  • 11. “For the things we have to learn before we can do them, we learn by doing them.” ~Aristotle
  • 12.
  • 13. Project Objectives • Build Consensus • Focus on Learning • Leverage Windows Azure
  • 14. Decomposing the Domain Conference Discounts Orders & Management Registrations Payments
  • 15. demo >> conference management system
  • 16. When to Use CQRS? • Do multiple users compete for access to the same resources? • Are the business rules ever changing? • Is scalability one of the challenges? • Is the business logic complex? • Are benefits that CQRS brings clear?
  • 17. Benefits CQRS & Event Sourcing • Integration with other systems / screens • Versioning / Evolution • Team development • Testing • Performance can be fine-tuned separately
  • 18. Some Lessons Learned • Throw away your assumptions • CQRS space is a little confusing - inconsistency, dissonance • Not a top-level architecture • Not everything needs to be asynchronous, nor message-based • In messaging, tracing matters big time • Test for performance early • Find or build a robust infrastructure that fits your needs • “Sagas” != sagas; Avoid them at first
  • 20. Resources microsoft.com/practices Project Personal • cqrsjourney.github.com • @bennage • aka.ms/cqrs • dev.bennage.com • aka.ms/cqrspdf

Notes de l'éditeur

  1. A very popular topic in the developer community.But also an area where there was lots of confusion.This was a different kind of project for p&p.Not about Prescriptive Guidance,More of a Journal of Our Experiences, a Case Study
  2. Similar to CQS, but applied to a BC/Subsystem as opposed to Objects.
  3. If you are using an ORM, such as Entity Framework or Nhibernate, then you would have two different models: write and read.There would be no need for lazy loading.
  4. Now that you have different models, you can go to the next step and have separate data stores.Not required for CQRS.This could be replication, transformation, projection, etc.This is good for scalability. Because READS tend to outnumber WRITES.Queries can be expensive, we want to make them cheaper.
  5. ES contains a lot more information.Tries to preserve events that make sense in the business (with its intent)To get the current status, you can get the event stream and replay.Not very easy to query other than by ID.
  6. From Nicomachean Ethics
  7. We were exploring the landscape.Report our findings.Not a Framework, not a LibraryThe idea is to go through building a non-trivial system that uses CQRS and event sourcing and report back on the lessons learnt.
  8. Conference Management – setting up a conferenceOrders & Registration – for reserving and purchasing ticketsPayments – for interacting with external payment providerDiscounts – not implemented (et al)
  9. Infrastructure: needs to scale out? Messaging. code evolution No downtime migrationsIf messaging: follow best practices for scalability.