SlideShare uma empresa Scribd logo
1 de 18
Design | Expose APIs with CQRS
Quick Recap
Modeling Process
● Identification
○ Who (peoples, entities )use it ?
○ When they are going to do ?
○ External or internal ?
● Break into steps
● Definition
● Validation
○ Test
○ Document
● Creation
○ Find resources
○ Relation between resources
Verbs and Nouns
If you want to dining out at nice places that you have to call ahead to reserve a
table
What are the problem ?
Principles :)
Principles
● Separation of concerns
● Reusable components
● DRY
● KISS
● SOLID
● …
BTW, everything comes at a price !
Complexity comes to table
● Scalability
● Availability
● Security
● Performance
● …
● ....
● Representation(the same data using multiple models, ...)
Representation
Most important part of a business is the state of the data.
● Decisions
● Roadmap
● Application functionality
● User experience
● ….
Taking care of state ? How ?
Event Sourcing
● Capture all changes to an application state as a sequence of events
The fundamental idea of Event Sourcing is that of ensuring every
change to the state of an application is captured in an event object, and
that these event objects are themselves stored in the sequence they
were applied for the same lifetime as the application state itself.
https://martinfowler.com/eaaDev/EventSourcing.html
Event sourcing Pros (continued)
● Bypass the O-R impedance mismatch
● Easy way to undo things
● Debuggability and traceability
a. Every change to state is traceable
b. You know how the system got into the current state
c. Metadata like "who did that" and "when did it happen"
● After-the-fact data analysis of Event Streams
● Awesome for writing data
https://en.wikipedia.org/wiki/Object-relational_impedance_mismatch
Event sourcing Cons (continued)
● Takes getting used to
● Much less framework/community/vendor support
● Awkward queries (solved by CQRS) (terrible for reading)
Should I be doing Event Sourcing?
● you're building rich object-oriented domain models (e.g. DDD)
● you have a lot of behaviour that isn't CRUD
● accountability/debuggability is critical
● you need version control/undo for data (e. G. Wikis, Google Docs)
● your business derives value or competitive advantage from event data
● your domain is inherently event driven (e. G. football game tracking)
● you're building a scalable system based on the CQRS pattern
CQRS (Command Query Responsibility Segregation)
Segregate operations that read data from operations that update data by using
separate interfaces. This can maximize performance, scalability, and security.
If the problem is having multiple and disparate views, we can exclude them from
the Domain Model and start treating them as a purely infrastructural concern
https://docs.microsoft.com/en-us/azure/architecture/patterns/cqrs
Pros
● Your system should display its entities in different representation models.
● You have to support different querying models (search, graph, documents, etc.).
● The difference between writes and reads differs greatly, and you want to scale
them independently.
Cons
● Eventual consistency (make persistence transactional)
● Still complex fellow
● Complex Monitoring and infrastructure
Concepts
● Event Stream
● Event Store
● Snapshot Store
● Projection
● Service Bus
Example

Mais conteúdo relacionado

Semelhante a Design | expose ap is with cqrs

Running Data Platforms Like Products
Running Data Platforms Like ProductsRunning Data Platforms Like Products
Running Data Platforms Like Products
VMware Tanzu
 
Using Data Science to Build an End-to-End Recommendation System
Using Data Science to Build an End-to-End Recommendation SystemUsing Data Science to Build an End-to-End Recommendation System
Using Data Science to Build an End-to-End Recommendation System
VMware Tanzu
 

Semelhante a Design | expose ap is with cqrs (20)

Deconstructing Monoliths with Domain Driven Design
Deconstructing Monoliths with Domain Driven DesignDeconstructing Monoliths with Domain Driven Design
Deconstructing Monoliths with Domain Driven Design
 
JavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsJavaScript for Enterprise Applications
JavaScript for Enterprise Applications
 
Running Data Platforms Like Products
Running Data Platforms Like ProductsRunning Data Platforms Like Products
Running Data Platforms Like Products
 
Enabling Next Gen Analytics with Azure Data Lake and StreamSets
Enabling Next Gen Analytics with Azure Data Lake and StreamSetsEnabling Next Gen Analytics with Azure Data Lake and StreamSets
Enabling Next Gen Analytics with Azure Data Lake and StreamSets
 
Big Data overview
Big Data overviewBig Data overview
Big Data overview
 
Shaping serverless architecture with domain driven design patterns - py web-il
Shaping serverless architecture with domain driven design patterns - py web-ilShaping serverless architecture with domain driven design patterns - py web-il
Shaping serverless architecture with domain driven design patterns - py web-il
 
SPSChicagoBurbs 2019 - What is CDM and CDS?
SPSChicagoBurbs 2019 - What is CDM and CDS?SPSChicagoBurbs 2019 - What is CDM and CDS?
SPSChicagoBurbs 2019 - What is CDM and CDS?
 
End to end MLworkflows
End to end MLworkflowsEnd to end MLworkflows
End to end MLworkflows
 
Microservices as an evolutionary architecture: lessons learned
Microservices as an evolutionary architecture: lessons learnedMicroservices as an evolutionary architecture: lessons learned
Microservices as an evolutionary architecture: lessons learned
 
SDSC18 and DSATL Meetup March 2018
SDSC18 and DSATL Meetup March 2018 SDSC18 and DSATL Meetup March 2018
SDSC18 and DSATL Meetup March 2018
 
SPS Vancouver 2018 - What is CDM and CDS
SPS Vancouver 2018 - What is CDM and CDSSPS Vancouver 2018 - What is CDM and CDS
SPS Vancouver 2018 - What is CDM and CDS
 
Break Up the Monolith- Testing Microservices by Marcus Merrell
Break Up the Monolith- Testing Microservices by Marcus MerrellBreak Up the Monolith- Testing Microservices by Marcus Merrell
Break Up the Monolith- Testing Microservices by Marcus Merrell
 
AppliFire Blue Print Design Guidelines
AppliFire Blue Print Design GuidelinesAppliFire Blue Print Design Guidelines
AppliFire Blue Print Design Guidelines
 
Data Virtualization: Introduction and Business Value (UK)
Data Virtualization: Introduction and Business Value (UK)Data Virtualization: Introduction and Business Value (UK)
Data Virtualization: Introduction and Business Value (UK)
 
(Greach 2015) Decathlon Sport Meeting
(Greach 2015) Decathlon Sport Meeting(Greach 2015) Decathlon Sport Meeting
(Greach 2015) Decathlon Sport Meeting
 
Quick dive into the big data pool without drowning - Demi Ben-Ari @ Panorays
Quick dive into the big data pool without drowning - Demi Ben-Ari @ PanoraysQuick dive into the big data pool without drowning - Demi Ben-Ari @ Panorays
Quick dive into the big data pool without drowning - Demi Ben-Ari @ Panorays
 
Glasswall Wardley Maps & Services
Glasswall Wardley Maps & ServicesGlasswall Wardley Maps & Services
Glasswall Wardley Maps & Services
 
Overcoming Data Gravity in Multi-Cloud Enterprise Architectures
Overcoming Data Gravity in Multi-Cloud Enterprise ArchitecturesOvercoming Data Gravity in Multi-Cloud Enterprise Architectures
Overcoming Data Gravity in Multi-Cloud Enterprise Architectures
 
A federated information infrastructure that works
A federated information infrastructure that works A federated information infrastructure that works
A federated information infrastructure that works
 
Using Data Science to Build an End-to-End Recommendation System
Using Data Science to Build an End-to-End Recommendation SystemUsing Data Science to Build an End-to-End Recommendation System
Using Data Science to Build an End-to-End Recommendation System
 

Último

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Último (20)

%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 

Design | expose ap is with cqrs

  • 1. Design | Expose APIs with CQRS Quick Recap
  • 2. Modeling Process ● Identification ○ Who (peoples, entities )use it ? ○ When they are going to do ? ○ External or internal ? ● Break into steps ● Definition ● Validation ○ Test ○ Document ● Creation ○ Find resources ○ Relation between resources
  • 3. Verbs and Nouns If you want to dining out at nice places that you have to call ahead to reserve a table
  • 4. What are the problem ? Principles :)
  • 5. Principles ● Separation of concerns ● Reusable components ● DRY ● KISS ● SOLID ● … BTW, everything comes at a price !
  • 6. Complexity comes to table ● Scalability ● Availability ● Security ● Performance ● … ● .... ● Representation(the same data using multiple models, ...)
  • 7. Representation Most important part of a business is the state of the data. ● Decisions ● Roadmap ● Application functionality ● User experience ● ….
  • 8. Taking care of state ? How ?
  • 9. Event Sourcing ● Capture all changes to an application state as a sequence of events The fundamental idea of Event Sourcing is that of ensuring every change to the state of an application is captured in an event object, and that these event objects are themselves stored in the sequence they were applied for the same lifetime as the application state itself. https://martinfowler.com/eaaDev/EventSourcing.html
  • 10. Event sourcing Pros (continued) ● Bypass the O-R impedance mismatch ● Easy way to undo things ● Debuggability and traceability a. Every change to state is traceable b. You know how the system got into the current state c. Metadata like "who did that" and "when did it happen" ● After-the-fact data analysis of Event Streams ● Awesome for writing data https://en.wikipedia.org/wiki/Object-relational_impedance_mismatch
  • 11. Event sourcing Cons (continued) ● Takes getting used to ● Much less framework/community/vendor support ● Awkward queries (solved by CQRS) (terrible for reading)
  • 12. Should I be doing Event Sourcing? ● you're building rich object-oriented domain models (e.g. DDD) ● you have a lot of behaviour that isn't CRUD ● accountability/debuggability is critical ● you need version control/undo for data (e. G. Wikis, Google Docs) ● your business derives value or competitive advantage from event data ● your domain is inherently event driven (e. G. football game tracking) ● you're building a scalable system based on the CQRS pattern
  • 13. CQRS (Command Query Responsibility Segregation) Segregate operations that read data from operations that update data by using separate interfaces. This can maximize performance, scalability, and security. If the problem is having multiple and disparate views, we can exclude them from the Domain Model and start treating them as a purely infrastructural concern https://docs.microsoft.com/en-us/azure/architecture/patterns/cqrs
  • 14.
  • 15. Pros ● Your system should display its entities in different representation models. ● You have to support different querying models (search, graph, documents, etc.). ● The difference between writes and reads differs greatly, and you want to scale them independently. Cons ● Eventual consistency (make persistence transactional) ● Still complex fellow ● Complex Monitoring and infrastructure
  • 16.
  • 17. Concepts ● Event Stream ● Event Store ● Snapshot Store ● Projection ● Service Bus