SlideShare a Scribd company logo
1 of 42
CQRS

Tim Mahy
Agenda
• Why
  – History
  – Current architectures & challenges
• What
• Real life case
•   Command
•   Query
•   Responsibility
•   Segregation
• About the business and looking at the
  business with regards to
  – collaboration
• Not only for high-scalability requirements
• A set of difficult questions
• A fresh look at architecture and code design
• Touches
  – DDD
  – NoSQL
  – BDD
  – EDA
• TODO: Data Entry screen for a company
But what has changed
• Increase of
  – Commands
  – Queries
  – Searching
  – Users and Collaboration
Collaboration
• Locking strategies
Traditional architecture
TODO:
• Layers / Tiers
• Transformations
• Structured data
Let’s validate this design
• TODO: validate against new challenges
• + talk a bit about caching and ORM etc
<asp:DataList ID="DataList1" runat="server" DataSourceID="LastUsersDataSource">
  <ItemTemplate>
    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
    <br />
                                                                                  2 layer
  </ItemTemplate>
</asp:DataList>

<asp:SqlDataSource ID="LastUsersDataSource" runat="server" ConnectionString="<%$
ConnectionStringsMyConnectionString %>"
                                                                   Query model
  SelectCommand="SELECT [Name], [InsertDateTime] FROM [LastUsers] ORDER BY [InsertDateTime] DESC">
</asp:SqlDataSource>
Let’s go back to the essence
• Pattern to segregate approach for:
  – Commands
  – Queries
• Everything in ALM is touched by this
Commands
• Task driven UI
Commands
• Serialized method call on a root aggregate

•   Can say NO
•   Check business rules
•   Can be sync/async
•   Work best in a DDD world
    – 3 layered
    – No more worries for ‘slow’ reading
Queries
• Is not search!!
  – Lucene.NET
  – Google applieance
Queries
• Stale data

TODO: Mockup  straten
Queries
•   Return DTO
•   Less layered approach
•   Have their own state (persisted viewmodel)
•   No influence on command side
•   Easy domain
•   Datastore  does it need to be relational?
But how do we come to these
         persisted viewmodels
• Commands deliver business events (past
  tense)
• Business events mutate state on truth
  datastore and in persisted viewmodels
UI DataStore
     Queries
                                           Subscribe




UI   Commands
                                               EventBus


                Business Logic       Publish



                Truth (optional)
Business events sourcing
• Keep all business events
• Replay business events when needed
  – Snapshotting strategy when required
• Truth database can also be only these events
  in an ideal world
• Demo: event sourcing shopping cart
Other team members
• Testing
  – Given * events
  – When * command
  – Then * events
Tooling
• SimpleCQRS
• NServiceBus
Real life case
•   VECOZO
•   Project
•   Requirements
•   How CQRS helped us
•   Statistics
Project
• Receives all the health insurance information
  from the Netherlands
• Allow healtcare parties query to check for
  insurance and details
• Give insights back to the insurance companies
  and government
Requirements
• Every query should respond below 20ms
• Traditional .NET stack:
  – MS SQLServer 2008 R2
  – WCF SOAP webservices
• Must be able to respond to 600 query
  requests per second
• Must be able to process all data within 4
  hours
CQRS (zoals meest bekend)

                          UI DataStore
         Queries
                                               Subscribe




UI       Commands
                                                   EventBus


                    Business Logic       Publish



                    Truth (optional)
CQRS (zoals in AVG)

                            DataStore
Webserv     Queries
                                             Receive
 ices

                                                EventBus

          Commands
   PCS                Business Logic    Publish changes



                          Truth
Technical choices
• Event Sourcing is stored in MS SQLServer
• All queues are Sql Server Service Broker Queues
• Denormalizers are CLR stored procedures in
  query databases
• Query databases are all eventually consistent, no
  synchronisation context over health insurance
  companies
  – Very hard normalized (one table)
  – Dirty reads
  – Correction of data in-memory after reading
Statistics & Conclusion
• Statistics:
    – Event Sourcing: 190 GB
    – Persisted views: 80 GB
    – 72 health insurance companies deliver 80M insurance packages a day
      which are validated with commands
    – Which results in 169.000 business events a day
• Very easy to test
• Very easy to manage when
    – Failure
    – Failover
• Staged deployment
• Future proof
    – No more migrations ever
    – New systems just need to understand the business events
POC Event Sourcing:
 QueueUnlimited
QueueUnlimited
• Open Source project
• Very easy architecture for event sourcing
Queue Unlimited – no subscribers
• How it works


  PublishEvent SP   InitiatorService




                     RootService


                                       Stored Procedure

                                         SSB Service


                                           SSB Queue enabled

                                           SSB Queue disabled


                                          Activation SP enabled

                                          Activation SP disabled

                                           SSB Dialog / Send
Queue Unlimited – Adding a subscriber

 PublishEvent SP               InitiatorService




                                RootService
                                                                     Activated




        Subscriber 1 Service                      Replay 1 Service
                                                                                    Not
                                                                                 activated




             Some app
QUEUE UNLIMITED – Adding another subscriber

         SendEvent SP                   Initiator service



                                         Root Service

                                                                                    Activated




                Subscriber 1 Service                        Replay 1 Service
                                                                                                  Activated


           Some app




                                                                                                                 Not
                                Subscriber 2 Service                           Replay 2 Service
                                                                                                              activated



                                       Some app
QUEUE UNLIMITED – Garbage collection
                  SendEvent SP     Initiator service




                                     Root Service

                                                                    Activated




                                                                                   Not
      Subscriber 1 Service       Subscriber 2 Service   Replay 2 Service
                                                                                activated



  Some app
                                     Some app
QUEUE UNLIMITED – Scale out
SendEvent SP                  Initiator service



                               Root Service




                                                               30% messages

       Subscriber 1 Service                       Replay 1 Service


                                                                              30% messages
  Some app                                        Replay 1 Service 2



                                                  Replay 1 Service 3
                                                                                  40% messages




                                                                       42

More Related Content

What's hot

Preparing forfirstconnectionsinstall
Preparing forfirstconnectionsinstallPreparing forfirstconnectionsinstall
Preparing forfirstconnectionsinstallGabriella Davis
 
Preventing serversickness
Preventing serversicknessPreventing serversickness
Preventing serversicknessGabriella Davis
 
Top 5 Reasons people are moving to Exchange 2010
Top 5 Reasons people are moving to Exchange 2010Top 5 Reasons people are moving to Exchange 2010
Top 5 Reasons people are moving to Exchange 2010John Westworth
 
Windows Server 2008 R2 Overview 1225768142880746 9
Windows Server 2008 R2 Overview 1225768142880746 9Windows Server 2008 R2 Overview 1225768142880746 9
Windows Server 2008 R2 Overview 1225768142880746 9Stephan - Gabriel Georgescu
 
WAN Optimierung mit Citrix Branch Repeater
WAN Optimierung mit Citrix Branch RepeaterWAN Optimierung mit Citrix Branch Repeater
WAN Optimierung mit Citrix Branch RepeaterDigicomp Academy AG
 

What's hot (6)

Preparing forfirstconnectionsinstall
Preparing forfirstconnectionsinstallPreparing forfirstconnectionsinstall
Preparing forfirstconnectionsinstall
 
Preventing serversickness
Preventing serversicknessPreventing serversickness
Preventing serversickness
 
Top 5 Reasons people are moving to Exchange 2010
Top 5 Reasons people are moving to Exchange 2010Top 5 Reasons people are moving to Exchange 2010
Top 5 Reasons people are moving to Exchange 2010
 
Private Cloud Day Session 1: Building your Private Cloud Infrastructure
Private Cloud Day Session 1: Building your Private Cloud InfrastructurePrivate Cloud Day Session 1: Building your Private Cloud Infrastructure
Private Cloud Day Session 1: Building your Private Cloud Infrastructure
 
Windows Server 2008 R2 Overview 1225768142880746 9
Windows Server 2008 R2 Overview 1225768142880746 9Windows Server 2008 R2 Overview 1225768142880746 9
Windows Server 2008 R2 Overview 1225768142880746 9
 
WAN Optimierung mit Citrix Branch Repeater
WAN Optimierung mit Citrix Branch RepeaterWAN Optimierung mit Citrix Branch Repeater
WAN Optimierung mit Citrix Branch Repeater
 

Viewers also liked

CQRS & Queue unlimited
CQRS & Queue unlimitedCQRS & Queue unlimited
CQRS & Queue unlimitedTim Mahy
 
STa R Chart West Rusk Junior High
STa R Chart West Rusk Junior HighSTa R Chart West Rusk Junior High
STa R Chart West Rusk Junior HighShannon King
 
2010 iska - tim m - functioneel programmeren in c-sharp
2010   iska - tim m - functioneel programmeren in c-sharp2010   iska - tim m - functioneel programmeren in c-sharp
2010 iska - tim m - functioneel programmeren in c-sharpTim Mahy
 
Tarea1 daniel sánchez
Tarea1 daniel sánchezTarea1 daniel sánchez
Tarea1 daniel sáncheznielo19
 
2009 seminar - tim m - vs 2010 developer edition
2009   seminar - tim m - vs 2010 developer edition2009   seminar - tim m - vs 2010 developer edition
2009 seminar - tim m - vs 2010 developer editionTim Mahy
 
Mineral Lecture
Mineral  LectureMineral  Lecture
Mineral Lecturege1030
 
2012 student track - vs2010
2012   student track - vs20102012   student track - vs2010
2012 student track - vs2010Tim Mahy
 
2009 training - tim m - object oriented programming
2009   training - tim m - object oriented programming2009   training - tim m - object oriented programming
2009 training - tim m - object oriented programmingTim Mahy
 
Minnesota D-Star Disaster Network
Minnesota D-Star Disaster Network Minnesota D-Star Disaster Network
Minnesota D-Star Disaster Network Erik Westgard
 
Mo 09 G3 Intez Ali Portfolio
Mo 09 G3 Intez Ali PortfolioMo 09 G3 Intez Ali Portfolio
Mo 09 G3 Intez Ali Portfoliointezali
 
14 февраля
14 февраля14 февраля
14 февраляsvetlanka
 
Minnesota Amateur Radio Marathon Support
Minnesota Amateur Radio Marathon Support Minnesota Amateur Radio Marathon Support
Minnesota Amateur Radio Marathon Support Erik Westgard
 

Viewers also liked (18)

CQRS & Queue unlimited
CQRS & Queue unlimitedCQRS & Queue unlimited
CQRS & Queue unlimited
 
STa R Chart West Rusk Junior High
STa R Chart West Rusk Junior HighSTa R Chart West Rusk Junior High
STa R Chart West Rusk Junior High
 
2010 iska - tim m - functioneel programmeren in c-sharp
2010   iska - tim m - functioneel programmeren in c-sharp2010   iska - tim m - functioneel programmeren in c-sharp
2010 iska - tim m - functioneel programmeren in c-sharp
 
Tarea1 daniel sánchez
Tarea1 daniel sánchezTarea1 daniel sánchez
Tarea1 daniel sánchez
 
Intez Ali
Intez AliIntez Ali
Intez Ali
 
2009 seminar - tim m - vs 2010 developer edition
2009   seminar - tim m - vs 2010 developer edition2009   seminar - tim m - vs 2010 developer edition
2009 seminar - tim m - vs 2010 developer edition
 
Tin
TinTin
Tin
 
Mineral Lecture
Mineral  LectureMineral  Lecture
Mineral Lecture
 
2012 student track - vs2010
2012   student track - vs20102012   student track - vs2010
2012 student track - vs2010
 
Taller paper
Taller paperTaller paper
Taller paper
 
2009 training - tim m - object oriented programming
2009   training - tim m - object oriented programming2009   training - tim m - object oriented programming
2009 training - tim m - object oriented programming
 
Diaconaat 2.0
Diaconaat 2.0Diaconaat 2.0
Diaconaat 2.0
 
Minnesota D-Star Disaster Network
Minnesota D-Star Disaster Network Minnesota D-Star Disaster Network
Minnesota D-Star Disaster Network
 
Mo 09 G3 Intez Ali Portfolio
Mo 09 G3 Intez Ali PortfolioMo 09 G3 Intez Ali Portfolio
Mo 09 G3 Intez Ali Portfolio
 
14 февраля
14 февраля14 февраля
14 февраля
 
Minnesota Amateur Radio Marathon Support
Minnesota Amateur Radio Marathon Support Minnesota Amateur Radio Marathon Support
Minnesota Amateur Radio Marathon Support
 
Koreatown
KoreatownKoreatown
Koreatown
 
Mondragó
MondragóMondragó
Mondragó
 

Similar to communityday 2012 - cqrs

Oracle Application Management Suite
Oracle Application Management SuiteOracle Application Management Suite
Oracle Application Management SuiteOracleVolutionSeries
 
Ruslan Belkin And Sean Dawson on LinkedIn's Network Updates Uncovered
Ruslan Belkin And Sean Dawson on LinkedIn's Network Updates UncoveredRuslan Belkin And Sean Dawson on LinkedIn's Network Updates Uncovered
Ruslan Belkin And Sean Dawson on LinkedIn's Network Updates UncoveredLinkedIn
 
Real User Experience Insight External
Real User Experience Insight ExternalReal User Experience Insight External
Real User Experience Insight Externaloracleonthebrain
 
Scaling habits of ASP.NET
Scaling habits of ASP.NETScaling habits of ASP.NET
Scaling habits of ASP.NETDavid Giard
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architectureandreaskallberg
 
Implementing advanced integration patterns with WSO2 ESB
Implementing advanced integration patterns with WSO2 ESBImplementing advanced integration patterns with WSO2 ESB
Implementing advanced integration patterns with WSO2 ESBWSO2
 
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
 
WF and WCF with AppFabric – Application Infrastructure for OnPremise Services
WF and WCF with AppFabric – Application Infrastructure for OnPremise ServicesWF and WCF with AppFabric – Application Infrastructure for OnPremise Services
WF and WCF with AppFabric – Application Infrastructure for OnPremise ServicesSaltmarch Media
 
Microservice creation using spring cloud, zipkin, ribbon, zull, eureka
Microservice creation using spring cloud, zipkin, ribbon, zull, eurekaMicroservice creation using spring cloud, zipkin, ribbon, zull, eureka
Microservice creation using spring cloud, zipkin, ribbon, zull, eurekaBinit Pathak
 
Netflix0SS Services on Docker
Netflix0SS Services on DockerNetflix0SS Services on Docker
Netflix0SS Services on DockerDocker, Inc.
 
Ibm cloud nativenetflixossfinal
Ibm cloud nativenetflixossfinalIbm cloud nativenetflixossfinal
Ibm cloud nativenetflixossfinalaspyker
 
Event Driven Architectures - Net Conf UY 2018
Event Driven Architectures - Net Conf UY 2018Event Driven Architectures - Net Conf UY 2018
Event Driven Architectures - Net Conf UY 2018Bradley Irby
 
Performance Engineering Case Study V1.0
Performance Engineering Case Study    V1.0Performance Engineering Case Study    V1.0
Performance Engineering Case Study V1.0sambitgarnaik
 
Debugging Microservices - key challenges and techniques - Microservices Odesa...
Debugging Microservices - key challenges and techniques - Microservices Odesa...Debugging Microservices - key challenges and techniques - Microservices Odesa...
Debugging Microservices - key challenges and techniques - Microservices Odesa...Lohika_Odessa_TechTalks
 
Tech talk microservices debugging
Tech talk microservices debuggingTech talk microservices debugging
Tech talk microservices debuggingAndrey Kolodnitsky
 
Composite Applications with SOA, BPEL and Java EE
Composite  Applications with SOA, BPEL and Java EEComposite  Applications with SOA, BPEL and Java EE
Composite Applications with SOA, BPEL and Java EEDmitri Shiryaev
 
Disruptive Trends in Application Development
Disruptive Trends in Application DevelopmentDisruptive Trends in Application Development
Disruptive Trends in Application DevelopmentWaveMaker, Inc.
 
Applying Novell Identity Manager to Your Everyday Problems
Applying Novell Identity Manager to Your Everyday ProblemsApplying Novell Identity Manager to Your Everyday Problems
Applying Novell Identity Manager to Your Everyday ProblemsNovell
 

Similar to communityday 2012 - cqrs (20)

Oracle Application Management Suite
Oracle Application Management SuiteOracle Application Management Suite
Oracle Application Management Suite
 
Ruslan Belkin And Sean Dawson on LinkedIn's Network Updates Uncovered
Ruslan Belkin And Sean Dawson on LinkedIn's Network Updates UncoveredRuslan Belkin And Sean Dawson on LinkedIn's Network Updates Uncovered
Ruslan Belkin And Sean Dawson on LinkedIn's Network Updates Uncovered
 
Real User Experience Insight External
Real User Experience Insight ExternalReal User Experience Insight External
Real User Experience Insight External
 
Scaling habits of ASP.NET
Scaling habits of ASP.NETScaling habits of ASP.NET
Scaling habits of ASP.NET
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
 
Implementing advanced integration patterns with WSO2 ESB
Implementing advanced integration patterns with WSO2 ESBImplementing advanced integration patterns with WSO2 ESB
Implementing advanced integration patterns with WSO2 ESB
 
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
 
WF and WCF with AppFabric – Application Infrastructure for OnPremise Services
WF and WCF with AppFabric – Application Infrastructure for OnPremise ServicesWF and WCF with AppFabric – Application Infrastructure for OnPremise Services
WF and WCF with AppFabric – Application Infrastructure for OnPremise Services
 
Microservice creation using spring cloud, zipkin, ribbon, zull, eureka
Microservice creation using spring cloud, zipkin, ribbon, zull, eurekaMicroservice creation using spring cloud, zipkin, ribbon, zull, eureka
Microservice creation using spring cloud, zipkin, ribbon, zull, eureka
 
Netflix0SS Services on Docker
Netflix0SS Services on DockerNetflix0SS Services on Docker
Netflix0SS Services on Docker
 
Ibm cloud nativenetflixossfinal
Ibm cloud nativenetflixossfinalIbm cloud nativenetflixossfinal
Ibm cloud nativenetflixossfinal
 
Event Driven Architectures - Net Conf UY 2018
Event Driven Architectures - Net Conf UY 2018Event Driven Architectures - Net Conf UY 2018
Event Driven Architectures - Net Conf UY 2018
 
Servicedesk Plus 8
Servicedesk Plus 8Servicedesk Plus 8
Servicedesk Plus 8
 
Performance Engineering Case Study V1.0
Performance Engineering Case Study    V1.0Performance Engineering Case Study    V1.0
Performance Engineering Case Study V1.0
 
Edge-to-Enterprise Real-Time SOA
Edge-to-Enterprise Real-Time SOAEdge-to-Enterprise Real-Time SOA
Edge-to-Enterprise Real-Time SOA
 
Debugging Microservices - key challenges and techniques - Microservices Odesa...
Debugging Microservices - key challenges and techniques - Microservices Odesa...Debugging Microservices - key challenges and techniques - Microservices Odesa...
Debugging Microservices - key challenges and techniques - Microservices Odesa...
 
Tech talk microservices debugging
Tech talk microservices debuggingTech talk microservices debugging
Tech talk microservices debugging
 
Composite Applications with SOA, BPEL and Java EE
Composite  Applications with SOA, BPEL and Java EEComposite  Applications with SOA, BPEL and Java EE
Composite Applications with SOA, BPEL and Java EE
 
Disruptive Trends in Application Development
Disruptive Trends in Application DevelopmentDisruptive Trends in Application Development
Disruptive Trends in Application Development
 
Applying Novell Identity Manager to Your Everyday Problems
Applying Novell Identity Manager to Your Everyday ProblemsApplying Novell Identity Manager to Your Everyday Problems
Applying Novell Identity Manager to Your Everyday Problems
 

Recently uploaded

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Recently uploaded (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

communityday 2012 - cqrs

  • 2. Agenda • Why – History – Current architectures & challenges • What • Real life case
  • 3. Command • Query • Responsibility • Segregation
  • 4. • About the business and looking at the business with regards to – collaboration • Not only for high-scalability requirements • A set of difficult questions • A fresh look at architecture and code design
  • 5. • Touches – DDD – NoSQL – BDD – EDA
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. • TODO: Data Entry screen for a company
  • 12. But what has changed • Increase of – Commands – Queries – Searching – Users and Collaboration
  • 14. Traditional architecture TODO: • Layers / Tiers • Transformations • Structured data
  • 15. Let’s validate this design • TODO: validate against new challenges • + talk a bit about caching and ORM etc
  • 16. <asp:DataList ID="DataList1" runat="server" DataSourceID="LastUsersDataSource"> <ItemTemplate> <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /> <br /> 2 layer </ItemTemplate> </asp:DataList> <asp:SqlDataSource ID="LastUsersDataSource" runat="server" ConnectionString="<%$ ConnectionStringsMyConnectionString %>" Query model SelectCommand="SELECT [Name], [InsertDateTime] FROM [LastUsers] ORDER BY [InsertDateTime] DESC"> </asp:SqlDataSource>
  • 17. Let’s go back to the essence • Pattern to segregate approach for: – Commands – Queries • Everything in ALM is touched by this
  • 19. Commands • Serialized method call on a root aggregate • Can say NO • Check business rules • Can be sync/async • Work best in a DDD world – 3 layered – No more worries for ‘slow’ reading
  • 20. Queries • Is not search!! – Lucene.NET – Google applieance
  • 21. Queries • Stale data TODO: Mockup  straten
  • 22. Queries • Return DTO • Less layered approach • Have their own state (persisted viewmodel) • No influence on command side • Easy domain • Datastore  does it need to be relational?
  • 23. But how do we come to these persisted viewmodels • Commands deliver business events (past tense) • Business events mutate state on truth datastore and in persisted viewmodels
  • 24. UI DataStore Queries Subscribe UI Commands EventBus Business Logic Publish Truth (optional)
  • 25. Business events sourcing • Keep all business events • Replay business events when needed – Snapshotting strategy when required • Truth database can also be only these events in an ideal world
  • 26. • Demo: event sourcing shopping cart
  • 27. Other team members • Testing – Given * events – When * command – Then * events
  • 29. Real life case • VECOZO • Project • Requirements • How CQRS helped us • Statistics
  • 30. Project • Receives all the health insurance information from the Netherlands • Allow healtcare parties query to check for insurance and details • Give insights back to the insurance companies and government
  • 31. Requirements • Every query should respond below 20ms • Traditional .NET stack: – MS SQLServer 2008 R2 – WCF SOAP webservices • Must be able to respond to 600 query requests per second • Must be able to process all data within 4 hours
  • 32. CQRS (zoals meest bekend) UI DataStore Queries Subscribe UI Commands EventBus Business Logic Publish Truth (optional)
  • 33. CQRS (zoals in AVG) DataStore Webserv Queries Receive ices EventBus Commands PCS Business Logic Publish changes Truth
  • 34. Technical choices • Event Sourcing is stored in MS SQLServer • All queues are Sql Server Service Broker Queues • Denormalizers are CLR stored procedures in query databases • Query databases are all eventually consistent, no synchronisation context over health insurance companies – Very hard normalized (one table) – Dirty reads – Correction of data in-memory after reading
  • 35. Statistics & Conclusion • Statistics: – Event Sourcing: 190 GB – Persisted views: 80 GB – 72 health insurance companies deliver 80M insurance packages a day which are validated with commands – Which results in 169.000 business events a day • Very easy to test • Very easy to manage when – Failure – Failover • Staged deployment • Future proof – No more migrations ever – New systems just need to understand the business events
  • 36. POC Event Sourcing: QueueUnlimited
  • 37. QueueUnlimited • Open Source project • Very easy architecture for event sourcing
  • 38. Queue Unlimited – no subscribers • How it works PublishEvent SP InitiatorService RootService Stored Procedure SSB Service SSB Queue enabled SSB Queue disabled Activation SP enabled Activation SP disabled SSB Dialog / Send
  • 39. Queue Unlimited – Adding a subscriber PublishEvent SP InitiatorService RootService Activated Subscriber 1 Service Replay 1 Service Not activated Some app
  • 40. QUEUE UNLIMITED – Adding another subscriber SendEvent SP Initiator service Root Service Activated Subscriber 1 Service Replay 1 Service Activated Some app Not Subscriber 2 Service Replay 2 Service activated Some app
  • 41. QUEUE UNLIMITED – Garbage collection SendEvent SP Initiator service Root Service Activated Not Subscriber 1 Service Subscriber 2 Service Replay 2 Service activated Some app Some app
  • 42. QUEUE UNLIMITED – Scale out SendEvent SP Initiator service Root Service 30% messages Subscriber 1 Service Replay 1 Service 30% messages Some app Replay 1 Service 2 Replay 1 Service 3 40% messages 42