SlideShare uma empresa Scribd logo
1 de 16
CQRS, Related Patterns & Lessons Being Learned
What’s ahead Real quick overview of CQRS Some related patterns Event sourcing Pub-sub Experience Report from 2 CQRS projects (WIP) 1 Enterprise IT app in Insurance 1 cloud based app in Education
Separate methods for Commands & Queries From: Object-Oriented Software Construction, 2nd Edition by Bertrand Meyer
Technical Complexity From: http://blog.fohjin.com/blog/2009/11/12/CQRS_a_la_Greg_Young Complexity Problem/Domain
Façadelient Bus Commands Eventually Consistent Queries Handler
Subscriber Subscriber Publisher Subscribers Subscriber
ID : 123 Name : The Art of War Author: Sun Tzu ISBN: 1234ABCD5678 Event: BookIsbnChanged NewValue: 4321DCBA8765
…there are times when we don't just want to see where we are, we also want to know how we got there http://martinfowler.com/eaaDev/EventSourcing.html
publicclassBook : AggregateRoot<Book>     { privatestring _name; privateIsbn _isbn; privateGuid _id; privateBook()  { Handle<IsbnChangedEvent>(HandleIsbnChangedEvent);  } 	… publicvoidChangeIsbn(ChangeIsbnCommandchangeIsbnCommand)         { // Check any relevant business rules here IsbnChangedEvent @event =  newIsbnChangedEvent(_id, changeIsbnCommand.Isbn); Apply(changeIsbnCommand);         } publicvoidHandleIsbnChangedEvent(IsbnChangedEvent @event)         {             _isbn = @event.NewIsbn;         }     }
Experience Report 1: Application to be used to let Brokers create quotes and policies High Volume, low margin Integration with legacy app for reporting Legacy (& painful) Database
Document Generator Gateway DMS Policy Store Rating Data Reference Data Legacy Rating Engine Reports Reference Data Documents Domain & Plugins Handlers Façade – API (MVC) Client Web App
Experience Report 2: Users are regional reps of an exam board Globally located Integrate with back office systems Business benefit Allow business to grow with growing costs Provide a better service to customers
Main Event Store Reports Reports Handler API Handler Query API Domain API Domain Smart Client Web Client
Now go see: Videos CQRS E-VANs - Greg Young, UdiDahan, Mark Nijhof Event Sourcing - InfoQ Ian Cartwright Blogs Greg Young (CodeBetter) UdiDahan Mark Nijhof (Elegant Code) Code Samples/Frameworks (all Event Sourced) http://github.com/MarkNijhof/Fohjin (.NET) http://github.com/erikrozendaal/cqrs-lottery (Java) http://code.google.com/p/axonframework/ (Java)

Mais conteúdo relacionado

Destaque

Cqrs journey guide
Cqrs journey guideCqrs journey guide
Cqrs journey guide
Steve Xu
 
Cqrs + event sourcing pyxis v2 - en
Cqrs + event sourcing   pyxis v2 - enCqrs + event sourcing   pyxis v2 - en
Cqrs + event sourcing pyxis v2 - en
Eric De Carufel
 
Narrative Acceptance Tests River Glide Antony Marcano
Narrative Acceptance Tests River Glide Antony MarcanoNarrative Acceptance Tests River Glide Antony Marcano
Narrative Acceptance Tests River Glide Antony Marcano
Skills Matter
 

Destaque (9)

Cqrs journey guide
Cqrs journey guideCqrs journey guide
Cqrs journey guide
 
CQRS: high availability, scabaility, and maintainability
CQRS: high availability, scabaility, and maintainabilityCQRS: high availability, scabaility, and maintainability
CQRS: high availability, scabaility, and maintainability
 
Cqrs + event sourcing pyxis v2 - en
Cqrs + event sourcing   pyxis v2 - enCqrs + event sourcing   pyxis v2 - en
Cqrs + event sourcing pyxis v2 - en
 
Narrative Acceptance Tests River Glide Antony Marcano
Narrative Acceptance Tests River Glide Antony MarcanoNarrative Acceptance Tests River Glide Antony Marcano
Narrative Acceptance Tests River Glide Antony Marcano
 
Oc Cloud Obscurity
Oc Cloud ObscurityOc Cloud Obscurity
Oc Cloud Obscurity
 
Building occasionally connected applications using event sourcing
Building occasionally connected applications using event sourcingBuilding occasionally connected applications using event sourcing
Building occasionally connected applications using event sourcing
 
Command Query Responsibility Segregation (CQRS)
Command Query Responsibility Segregation (CQRS)Command Query Responsibility Segregation (CQRS)
Command Query Responsibility Segregation (CQRS)
 
Event Sourcing
Event SourcingEvent Sourcing
Event Sourcing
 
5 things cucumber is bad at by Richard Lawrence
5 things cucumber is bad at by Richard Lawrence5 things cucumber is bad at by Richard Lawrence
5 things cucumber is bad at by Richard Lawrence
 

Semelhante a Cqrs Ldnug 200100304

Social Network Gaming
Social Network GamingSocial Network Gaming
Social Network Gaming
Ashkan Mehran
 
Mohan_Dissertation (1)
Mohan_Dissertation (1)Mohan_Dissertation (1)
Mohan_Dissertation (1)
Mohan Bhargav
 
Agentless Monitoring with AdRem Software's NetCrunch 7
Agentless Monitoring with AdRem Software's NetCrunch 7Agentless Monitoring with AdRem Software's NetCrunch 7
Agentless Monitoring with AdRem Software's NetCrunch 7
Hamza Lazaar
 
SoftwareDesign2013_Assignment_Analysis_and_Design_Documentul
SoftwareDesign2013_Assignment_Analysis_and_Design_DocumentulSoftwareDesign2013_Assignment_Analysis_and_Design_Documentul
SoftwareDesign2013_Assignment_Analysis_and_Design_Documentul
Alin-Claudiu Nemes
 

Semelhante a Cqrs Ldnug 200100304 (20)

Social Network Gaming
Social Network GamingSocial Network Gaming
Social Network Gaming
 
NEW BACKEND.pdf
NEW BACKEND.pdfNEW BACKEND.pdf
NEW BACKEND.pdf
 
3D Materials Conference - Blockchain in 3D printing
3D Materials Conference - Blockchain in 3D printing3D Materials Conference - Blockchain in 3D printing
3D Materials Conference - Blockchain in 3D printing
 
Srs
SrsSrs
Srs
 
Implementing Event Sourcing in .NET
Implementing Event Sourcing in .NETImplementing Event Sourcing in .NET
Implementing Event Sourcing in .NET
 
Code, Test, Deploy The Essentials of Streamlined Application Development
Code, Test, Deploy The Essentials of Streamlined Application DevelopmentCode, Test, Deploy The Essentials of Streamlined Application Development
Code, Test, Deploy The Essentials of Streamlined Application Development
 
Advance Microservice Patterns - Event Souring , CQRS
Advance Microservice Patterns - Event Souring , CQRSAdvance Microservice Patterns - Event Souring , CQRS
Advance Microservice Patterns - Event Souring , CQRS
 
Mohan_Dissertation (1)
Mohan_Dissertation (1)Mohan_Dissertation (1)
Mohan_Dissertation (1)
 
The Best Practices of Symantec Code Signing - RapidSSLonline
The Best Practices of Symantec Code Signing - RapidSSLonlineThe Best Practices of Symantec Code Signing - RapidSSLonline
The Best Practices of Symantec Code Signing - RapidSSLonline
 
Agentless Monitoring with AdRem Software's NetCrunch 7
Agentless Monitoring with AdRem Software's NetCrunch 7Agentless Monitoring with AdRem Software's NetCrunch 7
Agentless Monitoring with AdRem Software's NetCrunch 7
 
Event storming Notes
Event storming NotesEvent storming Notes
Event storming Notes
 
Rfc3413
Rfc3413Rfc3413
Rfc3413
 
Agile contract for working software
Agile contract for working softwareAgile contract for working software
Agile contract for working software
 
The Intersection of Identity Management and Cloud Computing
The Intersection of Identity Management and Cloud ComputingThe Intersection of Identity Management and Cloud Computing
The Intersection of Identity Management and Cloud Computing
 
Security in mobile banking apps
Security in mobile banking appsSecurity in mobile banking apps
Security in mobile banking apps
 
Penetration Testing Project Game of Thrones CTF: 1
Penetration Testing Project Game of Thrones CTF: 1Penetration Testing Project Game of Thrones CTF: 1
Penetration Testing Project Game of Thrones CTF: 1
 
SoftwareDesign2013_Assignment_Analysis_and_Design_Documentul
SoftwareDesign2013_Assignment_Analysis_and_Design_DocumentulSoftwareDesign2013_Assignment_Analysis_and_Design_Documentul
SoftwareDesign2013_Assignment_Analysis_and_Design_Documentul
 
Pr crc
Pr crcPr crc
Pr crc
 
Introduction to Adversary Evaluation Tools
Introduction to Adversary Evaluation ToolsIntroduction to Adversary Evaluation Tools
Introduction to Adversary Evaluation Tools
 
Vulnerability Assessment and Penetration Testing Report
Vulnerability Assessment and Penetration Testing Report Vulnerability Assessment and Penetration Testing Report
Vulnerability Assessment and Penetration Testing Report
 

Mais de Skills Matter

Oscar reiken jr on our success at manheim
Oscar reiken jr on our success at manheimOscar reiken jr on our success at manheim
Oscar reiken jr on our success at manheim
Skills Matter
 
Russ miles-cloudfoundry-deep-dive
Russ miles-cloudfoundry-deep-diveRuss miles-cloudfoundry-deep-dive
Russ miles-cloudfoundry-deep-dive
Skills Matter
 
I went to_a_communications_workshop_and_they_t
I went to_a_communications_workshop_and_they_tI went to_a_communications_workshop_and_they_t
I went to_a_communications_workshop_and_they_t
Skills Matter
 

Mais de Skills Matter (20)

Patterns for slick database applications
Patterns for slick database applicationsPatterns for slick database applications
Patterns for slick database applications
 
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvmScala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
 
Oscar reiken jr on our success at manheim
Oscar reiken jr on our success at manheimOscar reiken jr on our success at manheim
Oscar reiken jr on our success at manheim
 
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
 
Cukeup nyc ian dees on elixir, erlang, and cucumberl
Cukeup nyc ian dees on elixir, erlang, and cucumberlCukeup nyc ian dees on elixir, erlang, and cucumberl
Cukeup nyc ian dees on elixir, erlang, and cucumberl
 
Cukeup nyc peter bell on getting started with cucumber.js
Cukeup nyc peter bell on getting started with cucumber.jsCukeup nyc peter bell on getting started with cucumber.js
Cukeup nyc peter bell on getting started with cucumber.js
 
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...
 
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
 
Progressive f# tutorials nyc don syme on keynote f# in the open source world
Progressive f# tutorials nyc don syme on keynote f# in the open source worldProgressive f# tutorials nyc don syme on keynote f# in the open source world
Progressive f# tutorials nyc don syme on keynote f# in the open source world
 
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...
 
Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#
 
A poet's guide_to_acceptance_testing
A poet's guide_to_acceptance_testingA poet's guide_to_acceptance_testing
A poet's guide_to_acceptance_testing
 
Russ miles-cloudfoundry-deep-dive
Russ miles-cloudfoundry-deep-diveRuss miles-cloudfoundry-deep-dive
Russ miles-cloudfoundry-deep-dive
 
Serendipity-neo4j
Serendipity-neo4jSerendipity-neo4j
Serendipity-neo4j
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelism
 
Plug 20110217
Plug   20110217Plug   20110217
Plug 20110217
 
Lug presentation
Lug presentationLug presentation
Lug presentation
 
I went to_a_communications_workshop_and_they_t
I went to_a_communications_workshop_and_they_tI went to_a_communications_workshop_and_they_t
I went to_a_communications_workshop_and_they_t
 
Plug saiku
Plug   saikuPlug   saiku
Plug saiku
 
Huguk lily
Huguk lilyHuguk lily
Huguk lily
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
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
Safe Software
 
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
Safe Software
 

Último (20)

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
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, ...
 
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
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
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
 
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
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
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
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
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...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 

Cqrs Ldnug 200100304

  • 1. CQRS, Related Patterns & Lessons Being Learned
  • 2. What’s ahead Real quick overview of CQRS Some related patterns Event sourcing Pub-sub Experience Report from 2 CQRS projects (WIP) 1 Enterprise IT app in Insurance 1 cloud based app in Education
  • 3.
  • 4.
  • 5. Separate methods for Commands & Queries From: Object-Oriented Software Construction, 2nd Edition by Bertrand Meyer
  • 6. Technical Complexity From: http://blog.fohjin.com/blog/2009/11/12/CQRS_a_la_Greg_Young Complexity Problem/Domain
  • 7. Façadelient Bus Commands Eventually Consistent Queries Handler
  • 8. Subscriber Subscriber Publisher Subscribers Subscriber
  • 9. ID : 123 Name : The Art of War Author: Sun Tzu ISBN: 1234ABCD5678 Event: BookIsbnChanged NewValue: 4321DCBA8765
  • 10. …there are times when we don't just want to see where we are, we also want to know how we got there http://martinfowler.com/eaaDev/EventSourcing.html
  • 11. publicclassBook : AggregateRoot<Book> { privatestring _name; privateIsbn _isbn; privateGuid _id; privateBook() { Handle<IsbnChangedEvent>(HandleIsbnChangedEvent); } … publicvoidChangeIsbn(ChangeIsbnCommandchangeIsbnCommand) { // Check any relevant business rules here IsbnChangedEvent @event = newIsbnChangedEvent(_id, changeIsbnCommand.Isbn); Apply(changeIsbnCommand); } publicvoidHandleIsbnChangedEvent(IsbnChangedEvent @event) { _isbn = @event.NewIsbn; } }
  • 12. Experience Report 1: Application to be used to let Brokers create quotes and policies High Volume, low margin Integration with legacy app for reporting Legacy (& painful) Database
  • 13. Document Generator Gateway DMS Policy Store Rating Data Reference Data Legacy Rating Engine Reports Reference Data Documents Domain & Plugins Handlers Façade – API (MVC) Client Web App
  • 14. Experience Report 2: Users are regional reps of an exam board Globally located Integrate with back office systems Business benefit Allow business to grow with growing costs Provide a better service to customers
  • 15. Main Event Store Reports Reports Handler API Handler Query API Domain API Domain Smart Client Web Client
  • 16. Now go see: Videos CQRS E-VANs - Greg Young, UdiDahan, Mark Nijhof Event Sourcing - InfoQ Ian Cartwright Blogs Greg Young (CodeBetter) UdiDahan Mark Nijhof (Elegant Code) Code Samples/Frameworks (all Event Sourced) http://github.com/MarkNijhof/Fohjin (.NET) http://github.com/erikrozendaal/cqrs-lottery (Java) http://code.google.com/p/axonframework/ (Java)

Notas do Editor

  1. Not the opinions of my employer
  2. Queries should not have side effects (change *observable* state) – state that can be observed by a clientFilling a cache is OKCommands should be void
  3. So at it’s simplest CQS represents a form of CQRSSeparate sub-systems for C &amp; Q – but still one databaseSeparate systems for C &amp; Q, with multiple databases – persisting snapshots of current stateSeparate system for C &amp; Q with event sourcing &amp; multiple databases
  4. Capturing all state changes made to an object as Event ObjectsAdvantages:Rebuild state from eventsTemporal Queries – rebuild state to a point in timeDebugging – replay events that led to a problemSnapshotsDisadvantagesCan look a bit magical
  5. 2 Phase State Transition
  6. Transactional boundary around writing policiesPolicy Store holds documents
  7. Events recorded per AREvents Published to LondonWhen ready London can merge in eventsExisting data started from snapshots