SlideShare a Scribd company logo
Greenfield Development with CQRS David Hoerster Co-Founder and CTO, BrainCredits
About Me C# MVP (April 2011) Co-Founder of BrainCredits (braincredits.com) Senior Technical Director for Resources Global Professionals President of Pittsburgh .NET Users Group Organizer of recent Pittsburgh Code Camps Twitter - @DavidHoerster Blog – http://geekswithblogs.net/DavidHoerster Email – david@braincredits.com
Goals Understanding the CQRS Architecture & Benefits (& Drawbacks) Commands Domain Objects Events Handlers Incorporating into Azure Queues and Blobs Fronting it with MVC
Pre-Requisites Some knowledge and familiarity with Domain Driven Design Some knowledge of Azure objects Some knowledge of ASP.NET MVC Leaving the notion that your data store must be normalized to the Nth degree at the door
Backstory Goals for BrainCredits.com Fast reads Scalable Handle, potentially, large volumes of requests Be able to change quickly Ability to track user in system and events that occur Easy to deploy, manage Inexpensive (FREE????)
Backstory Decided to jump into cloud with Azure BizSparkcompany Hey, it’s the cloud! Scalability Deployment via VS2010 Pretty inexpensive – no HW to manage But how to store data and design system?
Backstory I would recommend to start looking along the CQRS style of architectures - RinatAbdullin Articles by Greg Young, UdiDahan, J. Oliver, R. Abdullin
Traditional ArchitectureIssues Get all of the orders for user “David” in last 30 days
Traditional ArchitectureIssues Get all the orders for user ‘David’ in last 30 days SELECT c.FirstName, c.MiddleName, c.LastName, soh.SalesOrderID, soh.OrderDate, sod.UnitPrice, sod.OrderQty, sod.LineTotal, p.Name as 'ProductName', p.Color, p.ProductNumber, pm.Name as 'ProductModel', pc.Name as 'ProductCategory', pcParent.Name as 'ProductParentCategory' FROM SalesLT.Customer c INNER JOIN SalesLT.SalesOrderHeadersoh 		ON c.CustomerID = soh.CustomerID 		INNER JOIN SalesLT.SalesOrderDetail sod ON soh.SalesOrderID = sod.SalesOrderID 		INNER JOIN SalesLT.Product p ON sod.ProductID = p.ProductID 		INNER JOIN SalesLT.ProductModel pm ON p.ProductModelID = pm.ProductModelID 		INNER JOIN SalesLT.ProductCategory pc ON p.ProductCategoryID = pc.ProductCategoryID 		INNER JOIN SalesLT.ProductCategorypcParent ON pc.ParentProductCategoryID = pcParent.ProductCategoryID WHERE c.FirstName = 'David' 		AND soh.OrderDate > (GETDATE()-30)
Traditional ArchitectureIssues Wouldn’t it be great if it was something like? SELECT FirstName, MiddleName, LastName, SalesOrderID, OrderDate, UnitPrice, OrderQty, LineTotal, ProductName, Color, ProductNumber, ProductModel, ProductCategory, ProductParentCategory FROM CustomerSales WHERE FirstName= 'David' 	AND OrderDate> (GETDATE()-30)
Traditional ArchitecureIssues It seems that many applications cater to fast     C-U-D operations, but the Reads suffer Highly normalized databases Updating a Product Name is easy What would make querying faster? Reducing JOINS Flattening out our model Heresy! Business logic and domain objects bleed through layers as a result, too.
What Alternatives Are There? That’s where CQRS may be an option Provides for fast reads at the ‘expense’ of more expensive writes Once the data is read by the client, it’s already old A system that is eventually consistent is usually acceptable EVENTUAL CONSISTENCY! The read model for the system eventually is consistent with the system events Allows for scalability very easily Even in Azure! Encapsulates business logic in the domain Adheres strictly to CQS
What is CQRS Command Query Responsibility Segregation Based upon Bertrand Meyer’s Command Query Separation principle: “every method should either be a command that performs an action, or a query that returns data to the caller, but not both. In other words, asking a question should not change the answer” (Meyer) In essence, commands return acknowledgement; queries return data.
What is CQRS Recipe of CQRS Healthy serving of CQS Equal parts DDD Some denormalization for seasoning Add Event Sourcing to Taste Optionally Add Dash of NoSQL Optionally A Pinch of Cloud
What is CQRS Taking this further, CQRS describes an architecture where  commands are messages (possibly asynchronous) queries go against a read model Since commands are returning void, it allows for the message to be transformed into the read model If we’re transforming the message, why not make the read model as fast as possible? Since we’re transforming the message, perhaps we can take a few extra ticks for additional processing This flips the conventional wisdom of fast writes and slow reads Now we have fast reads and “slower” writes (since we’re writing to a denormalized store)
What is CQRS CQRS essentially splits your application into two parts The Read Side The Command Side The Read Side requests data and receives it The Command Side issues commands (inserts, updates, deletes) and receives just an acknowledgment that it was received.
What is CQRS (Simplified) Client Command Side Query Side Data Requested/Returned Command Issued – ack/nack Repository Command Service Domain (ARs) Event Handler Read Model Store Event Store Denormalizer
Getting Started Steps on the Command Side Command is issued Routed to proper Domain object method Domain raises zero, one or more Events Events handled by Denormalizer to persist data to read model Each step is really one or more messages being sent
Getting Started You can roll your own, or use a framework Several out there, including: NCQRS Lokad.CQRS Agr.CQRS on CodePlex (not much activity) Axon (Java) By using a framework, there are “extras”
CQRS Frameworks With NCQRS (ncqrs.org), you get: CQRS support Event Sourcing Support for SQL or NoSQL event sourcing Snapshotting Not always good things If you’re doing ‘pure’ or ‘true’ CQRS, then this is good Otherwise, may be overkill Don’t depend on the framework Let the framework help you, not constrict you
Demo – In Which David Turns To A Life-Long Desire – Buzzword Bingo Demo – BuzzyGo
Command Side Flow Event 1 Handler 1 Read Model Command Event 2 Handler 2 Domain Event N Handler N
Commands Simple message from the client to the back-end requesting something to be done Imperative tone CreateUser DeleteCard MarkSquare Contains enough information for the back-end to process the request No return value Maps to Aggregate Root’s constructor or method
Domain Command maps to a AR method/ctor Business logic happens here May assume validation done on client, but can be done here Business rules applied here e.g. FREE space is in the middle and is automatically marked. Once business rules applied, data is added to events that are applied. One or more events can be applied Once event is applied, domain updates itself and is added to the event source repository Not exposed to client, generally
Events Simple messages from domain Similar to commands But not the same Semantically different CardCreated; SquareMarked; CardWon Has enough information for event handler to write information to the read model
Denormalizer (Handler) Handles the events applied by the domain Should NOT perform any validation or business rules Its job is to perform minimal projections and transformations of data and then send that data to the repository/datastore Repository/DataStore being updated is the read model
Read Side Flow Request for Data Read Model Query Provider (Repo/WCFDS/etc) Client Query Results DTO
Where Can I Use CQRS? Windows apps Services Web apps Cloud-based apps Really doesn’t matter Just depends on the problem being solved
CQRS in the Cloud Hosting CQRS in Azure Really no different on the web side than a CQRS web app Typically, you’d want 2 roles Web Role for the UI, which also performs querying Worker Role for the Command handling Both roles can scale out as much as needed Multiple web roles with a single worker role, or vice versa or both!
Communication in theCloud How do I issue commands from my web role? 2 typical solutions WCF service on the worker role side Use Azure storage features (blobs, queues, tables) Both have advantages and disadvantages WCF is by default synchronous, so you’ll need to design for fire-and-forget But can be  easier to get up and running quickly Azure Storage has a lot of moving pieces Watch out for transaction costs!
Using Azure Storage General flow is this Web role issues a command by dropping it in a blob container (name is GUID). Command blob name is then dropped in a queue Worker role monitors queue for work When it finds a message in the queue, it grabs blob from storage based on id in queue message Deserializes command and then sends it through normal CQRS pipeline
CQRS in the Cloud Blob Storage Queue Controller Command Handler Domain Azure Table Storage Event(s) Repository Denormalizer Read Model
CQRS in the Cloud ASP.NET MVC Controller Reading data is no different, going through a Repository Writing data (issuing commands) involves dropping command into Azure Queue CloudHelper class facilitates this Also provides LogMessage facility
CQRS in the Cloud Using Azure Table Storage for logging user actions… Different than events.  Want to know user behavior. Storage is huge – just watch transaction costs Consider batching log reads But you can create replays of user interaction Similar to event sourcing’s replay of events Event sourcing doesn’t capture “Cancels” or “Reads”, which may be useful from a marketing perspective
Claim Credit for thisSession BrainCreditshttp://www.braincredits.com/Lesson/16852

More Related Content

What's hot

(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
Amazon Web Services
 
Syncromatics Akka.NET Case Study
Syncromatics Akka.NET Case StudySyncromatics Akka.NET Case Study
Syncromatics Akka.NET Case Study
petabridge
 
Automated Governance of Your AWS Resources
Automated Governance of Your AWS ResourcesAutomated Governance of Your AWS Resources
Automated Governance of Your AWS Resources
Amazon Web Services
 
Open stack ocata summit enabling aws lambda-like functionality with openstac...
Open stack ocata summit  enabling aws lambda-like functionality with openstac...Open stack ocata summit  enabling aws lambda-like functionality with openstac...
Open stack ocata summit enabling aws lambda-like functionality with openstac...
Shaun Murakami
 
Application Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless WorldApplication Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless World
Amazon Web Services
 
Docker and java
Docker and javaDocker and java
Docker and java
Anthony Dahanne
 
Deep Dive on Elastic Load Balancing
Deep Dive on Elastic Load BalancingDeep Dive on Elastic Load Balancing
Deep Dive on Elastic Load Balancing
Amazon Web Services
 
Operations: Security
Operations: SecurityOperations: Security
Operations: Security
Amazon Web Services
 
Production debugging web applications
Production debugging web applicationsProduction debugging web applications
Production debugging web applications
Ido Flatow
 
Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)
Jonas Bonér
 
Releasing Software Quickly and Reliably with AWS CodePipline
Releasing Software Quickly and Reliably with AWS CodePiplineReleasing Software Quickly and Reliably with AWS CodePipline
Releasing Software Quickly and Reliably with AWS CodePipline
Amazon Web Services
 
Introduction to AWS X-Ray
Introduction to AWS X-RayIntroduction to AWS X-Ray
Introduction to AWS X-Ray
Amazon Web Services
 
Serverless Architecture - A Gentle Overview
Serverless Architecture - A Gentle OverviewServerless Architecture - A Gentle Overview
Serverless Architecture - A Gentle Overview
CodeOps Technologies LLP
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Amazon Web Services
 
Containerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaContainerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS Lambda
Ryan Cuprak
 
Getting Started with Docker on AWS
Getting Started with Docker on AWSGetting Started with Docker on AWS
Getting Started with Docker on AWS
Amazon Web Services
 
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
Amazon Web Services
 
New AWS Services
New AWS ServicesNew AWS Services
New AWS Services
Josh Padnick
 
Jeffrey Richter
Jeffrey RichterJeffrey Richter
Jeffrey Richter
CodeFest
 
(SEC307) Building a DDoS-Resilient Architecture with Amazon Web Services | AW...
(SEC307) Building a DDoS-Resilient Architecture with Amazon Web Services | AW...(SEC307) Building a DDoS-Resilient Architecture with Amazon Web Services | AW...
(SEC307) Building a DDoS-Resilient Architecture with Amazon Web Services | AW...
Amazon Web Services
 

What's hot (20)

(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
 
Syncromatics Akka.NET Case Study
Syncromatics Akka.NET Case StudySyncromatics Akka.NET Case Study
Syncromatics Akka.NET Case Study
 
Automated Governance of Your AWS Resources
Automated Governance of Your AWS ResourcesAutomated Governance of Your AWS Resources
Automated Governance of Your AWS Resources
 
Open stack ocata summit enabling aws lambda-like functionality with openstac...
Open stack ocata summit  enabling aws lambda-like functionality with openstac...Open stack ocata summit  enabling aws lambda-like functionality with openstac...
Open stack ocata summit enabling aws lambda-like functionality with openstac...
 
Application Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless WorldApplication Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless World
 
Docker and java
Docker and javaDocker and java
Docker and java
 
Deep Dive on Elastic Load Balancing
Deep Dive on Elastic Load BalancingDeep Dive on Elastic Load Balancing
Deep Dive on Elastic Load Balancing
 
Operations: Security
Operations: SecurityOperations: Security
Operations: Security
 
Production debugging web applications
Production debugging web applicationsProduction debugging web applications
Production debugging web applications
 
Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)
 
Releasing Software Quickly and Reliably with AWS CodePipline
Releasing Software Quickly and Reliably with AWS CodePiplineReleasing Software Quickly and Reliably with AWS CodePipline
Releasing Software Quickly and Reliably with AWS CodePipline
 
Introduction to AWS X-Ray
Introduction to AWS X-RayIntroduction to AWS X-Ray
Introduction to AWS X-Ray
 
Serverless Architecture - A Gentle Overview
Serverless Architecture - A Gentle OverviewServerless Architecture - A Gentle Overview
Serverless Architecture - A Gentle Overview
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
 
Containerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaContainerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS Lambda
 
Getting Started with Docker on AWS
Getting Started with Docker on AWSGetting Started with Docker on AWS
Getting Started with Docker on AWS
 
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
 
New AWS Services
New AWS ServicesNew AWS Services
New AWS Services
 
Jeffrey Richter
Jeffrey RichterJeffrey Richter
Jeffrey Richter
 
(SEC307) Building a DDoS-Resilient Architecture with Amazon Web Services | AW...
(SEC307) Building a DDoS-Resilient Architecture with Amazon Web Services | AW...(SEC307) Building a DDoS-Resilient Architecture with Amazon Web Services | AW...
(SEC307) Building a DDoS-Resilient Architecture with Amazon Web Services | AW...
 

Viewers also liked

Reactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.NetReactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.Net
Sören Stelzer
 
Building responsive applications with Rx - CodeMash2017 - Tamir Dresher
Building responsive applications with Rx  - CodeMash2017 - Tamir DresherBuilding responsive applications with Rx  - CodeMash2017 - Tamir Dresher
Building responsive applications with Rx - CodeMash2017 - Tamir Dresher
Tamir Dresher
 
Drm and the web
Drm and the webDrm and the web
Drm and the web
Anthony Brown
 
Reactive applications with Akka.Net - DDD East Anglia 2015
Reactive applications with Akka.Net - DDD East Anglia 2015Reactive applications with Akka.Net - DDD East Anglia 2015
Reactive applications with Akka.Net - DDD East Anglia 2015
Anthony Brown
 
From Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir Dresher
From Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir DresherFrom Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir Dresher
From Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir Dresher
Tamir Dresher
 
Distributed Transactions in Akka.NET
Distributed Transactions in Akka.NETDistributed Transactions in Akka.NET
Distributed Transactions in Akka.NET
petabridge
 
Online game server on Akka.NET (NDC2016)
Online game server on Akka.NET (NDC2016)Online game server on Akka.NET (NDC2016)
Online game server on Akka.NET (NDC2016)
Esun Kim
 
CQRS and Event Sourcing, An Alternative Architecture for DDD
CQRS and Event Sourcing, An Alternative Architecture for DDDCQRS and Event Sourcing, An Alternative Architecture for DDD
CQRS and Event Sourcing, An Alternative Architecture for DDD
Dennis Doomen
 

Viewers also liked (8)

Reactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.NetReactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.Net
 
Building responsive applications with Rx - CodeMash2017 - Tamir Dresher
Building responsive applications with Rx  - CodeMash2017 - Tamir DresherBuilding responsive applications with Rx  - CodeMash2017 - Tamir Dresher
Building responsive applications with Rx - CodeMash2017 - Tamir Dresher
 
Drm and the web
Drm and the webDrm and the web
Drm and the web
 
Reactive applications with Akka.Net - DDD East Anglia 2015
Reactive applications with Akka.Net - DDD East Anglia 2015Reactive applications with Akka.Net - DDD East Anglia 2015
Reactive applications with Akka.Net - DDD East Anglia 2015
 
From Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir Dresher
From Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir DresherFrom Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir Dresher
From Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir Dresher
 
Distributed Transactions in Akka.NET
Distributed Transactions in Akka.NETDistributed Transactions in Akka.NET
Distributed Transactions in Akka.NET
 
Online game server on Akka.NET (NDC2016)
Online game server on Akka.NET (NDC2016)Online game server on Akka.NET (NDC2016)
Online game server on Akka.NET (NDC2016)
 
CQRS and Event Sourcing, An Alternative Architecture for DDD
CQRS and Event Sourcing, An Alternative Architecture for DDDCQRS and Event Sourcing, An Alternative Architecture for DDD
CQRS and Event Sourcing, An Alternative Architecture for DDD
 

Similar to Greenfield Development with CQRS

Modern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas JellemaModern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas Jellema
Lucas Jellema
 
Lets focus on business value
Lets focus on business valueLets focus on business value
Lets focus on business value
Einar Ingebrigtsen
 
Everything comes in 3's
Everything comes in 3'sEverything comes in 3's
Everything comes in 3's
delagoya
 
Cqrs and event sourcing in azure
Cqrs and event sourcing in azureCqrs and event sourcing in azure
Cqrs and event sourcing in azure
Sergey Seletsky
 
Sky High With Azure
Sky High With AzureSky High With Azure
Sky High With Azure
Clint Edmonson
 
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
Rustem Feyzkhanov
 
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Nati Shalom
 
Cosmos DB Real-time Advanced Analytics Workshop
Cosmos DB Real-time Advanced Analytics WorkshopCosmos DB Real-time Advanced Analytics Workshop
Cosmos DB Real-time Advanced Analytics Workshop
Databricks
 
Azure presentation nnug dec 2010
Azure presentation nnug  dec 2010Azure presentation nnug  dec 2010
Azure presentation nnug dec 2010
Ethos Technologies
 
Day Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure PlatformDay Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure Platform
Wade Wegner
 
2014.11.14 Data Opportunities with Azure
2014.11.14 Data Opportunities with Azure2014.11.14 Data Opportunities with Azure
2014.11.14 Data Opportunities with Azure
Marco Parenzan
 
SQL under the hood
SQL under the hoodSQL under the hood
SQL under the hood
Eduardo Castro
 
Windows Azure - Uma Plataforma para o Desenvolvimento de Aplicações
Windows Azure - Uma Plataforma para o Desenvolvimento de AplicaçõesWindows Azure - Uma Plataforma para o Desenvolvimento de Aplicações
Windows Azure - Uma Plataforma para o Desenvolvimento de Aplicações
Comunidade NetPonto
 
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
 
Why NBC Universal Migrated to MongoDB Atlas
Why NBC Universal Migrated to MongoDB AtlasWhy NBC Universal Migrated to MongoDB Atlas
Why NBC Universal Migrated to MongoDB Atlas
Datavail
 
ArcReady - Architecting For The Cloud
ArcReady - Architecting For The CloudArcReady - Architecting For The Cloud
ArcReady - Architecting For The Cloud
Microsoft ArcReady
 
CQRS & Queue unlimited
CQRS & Queue unlimitedCQRS & Queue unlimited
CQRS & Queue unlimited
Tim Mahy
 
A guide through the Azure Messaging services - Update Conference
A guide through the Azure Messaging services - Update ConferenceA guide through the Azure Messaging services - Update Conference
A guide through the Azure Messaging services - Update Conference
Eldert Grootenboer
 
The Story of How an Oracle Classic Stronghold successfully embraced SOA
The Story of How an Oracle Classic Stronghold successfully embraced SOAThe Story of How an Oracle Classic Stronghold successfully embraced SOA
The Story of How an Oracle Classic Stronghold successfully embraced SOA
Lucas Jellema
 
How to Architect a Serverless Cloud Data Lake for Enhanced Data Analytics
How to Architect a Serverless Cloud Data Lake for Enhanced Data AnalyticsHow to Architect a Serverless Cloud Data Lake for Enhanced Data Analytics
How to Architect a Serverless Cloud Data Lake for Enhanced Data Analytics
Informatica
 

Similar to Greenfield Development with CQRS (20)

Modern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas JellemaModern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas Jellema
 
Lets focus on business value
Lets focus on business valueLets focus on business value
Lets focus on business value
 
Everything comes in 3's
Everything comes in 3'sEverything comes in 3's
Everything comes in 3's
 
Cqrs and event sourcing in azure
Cqrs and event sourcing in azureCqrs and event sourcing in azure
Cqrs and event sourcing in azure
 
Sky High With Azure
Sky High With AzureSky High With Azure
Sky High With Azure
 
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
 
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
 
Cosmos DB Real-time Advanced Analytics Workshop
Cosmos DB Real-time Advanced Analytics WorkshopCosmos DB Real-time Advanced Analytics Workshop
Cosmos DB Real-time Advanced Analytics Workshop
 
Azure presentation nnug dec 2010
Azure presentation nnug  dec 2010Azure presentation nnug  dec 2010
Azure presentation nnug dec 2010
 
Day Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure PlatformDay Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure Platform
 
2014.11.14 Data Opportunities with Azure
2014.11.14 Data Opportunities with Azure2014.11.14 Data Opportunities with Azure
2014.11.14 Data Opportunities with Azure
 
SQL under the hood
SQL under the hoodSQL under the hood
SQL under the hood
 
Windows Azure - Uma Plataforma para o Desenvolvimento de Aplicações
Windows Azure - Uma Plataforma para o Desenvolvimento de AplicaçõesWindows Azure - Uma Plataforma para o Desenvolvimento de Aplicações
Windows Azure - Uma Plataforma para o Desenvolvimento de Aplicações
 
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...
 
Why NBC Universal Migrated to MongoDB Atlas
Why NBC Universal Migrated to MongoDB AtlasWhy NBC Universal Migrated to MongoDB Atlas
Why NBC Universal Migrated to MongoDB Atlas
 
ArcReady - Architecting For The Cloud
ArcReady - Architecting For The CloudArcReady - Architecting For The Cloud
ArcReady - Architecting For The Cloud
 
CQRS & Queue unlimited
CQRS & Queue unlimitedCQRS & Queue unlimited
CQRS & Queue unlimited
 
A guide through the Azure Messaging services - Update Conference
A guide through the Azure Messaging services - Update ConferenceA guide through the Azure Messaging services - Update Conference
A guide through the Azure Messaging services - Update Conference
 
The Story of How an Oracle Classic Stronghold successfully embraced SOA
The Story of How an Oracle Classic Stronghold successfully embraced SOAThe Story of How an Oracle Classic Stronghold successfully embraced SOA
The Story of How an Oracle Classic Stronghold successfully embraced SOA
 
How to Architect a Serverless Cloud Data Lake for Enhanced Data Analytics
How to Architect a Serverless Cloud Data Lake for Enhanced Data AnalyticsHow to Architect a Serverless Cloud Data Lake for Enhanced Data Analytics
How to Architect a Serverless Cloud Data Lake for Enhanced Data Analytics
 

Recently uploaded

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 

Recently uploaded (20)

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 

Greenfield Development with CQRS

  • 1. Greenfield Development with CQRS David Hoerster Co-Founder and CTO, BrainCredits
  • 2. About Me C# MVP (April 2011) Co-Founder of BrainCredits (braincredits.com) Senior Technical Director for Resources Global Professionals President of Pittsburgh .NET Users Group Organizer of recent Pittsburgh Code Camps Twitter - @DavidHoerster Blog – http://geekswithblogs.net/DavidHoerster Email – david@braincredits.com
  • 3. Goals Understanding the CQRS Architecture & Benefits (& Drawbacks) Commands Domain Objects Events Handlers Incorporating into Azure Queues and Blobs Fronting it with MVC
  • 4. Pre-Requisites Some knowledge and familiarity with Domain Driven Design Some knowledge of Azure objects Some knowledge of ASP.NET MVC Leaving the notion that your data store must be normalized to the Nth degree at the door
  • 5. Backstory Goals for BrainCredits.com Fast reads Scalable Handle, potentially, large volumes of requests Be able to change quickly Ability to track user in system and events that occur Easy to deploy, manage Inexpensive (FREE????)
  • 6. Backstory Decided to jump into cloud with Azure BizSparkcompany Hey, it’s the cloud! Scalability Deployment via VS2010 Pretty inexpensive – no HW to manage But how to store data and design system?
  • 7. Backstory I would recommend to start looking along the CQRS style of architectures - RinatAbdullin Articles by Greg Young, UdiDahan, J. Oliver, R. Abdullin
  • 8. Traditional ArchitectureIssues Get all of the orders for user “David” in last 30 days
  • 9. Traditional ArchitectureIssues Get all the orders for user ‘David’ in last 30 days SELECT c.FirstName, c.MiddleName, c.LastName, soh.SalesOrderID, soh.OrderDate, sod.UnitPrice, sod.OrderQty, sod.LineTotal, p.Name as 'ProductName', p.Color, p.ProductNumber, pm.Name as 'ProductModel', pc.Name as 'ProductCategory', pcParent.Name as 'ProductParentCategory' FROM SalesLT.Customer c INNER JOIN SalesLT.SalesOrderHeadersoh ON c.CustomerID = soh.CustomerID INNER JOIN SalesLT.SalesOrderDetail sod ON soh.SalesOrderID = sod.SalesOrderID INNER JOIN SalesLT.Product p ON sod.ProductID = p.ProductID INNER JOIN SalesLT.ProductModel pm ON p.ProductModelID = pm.ProductModelID INNER JOIN SalesLT.ProductCategory pc ON p.ProductCategoryID = pc.ProductCategoryID INNER JOIN SalesLT.ProductCategorypcParent ON pc.ParentProductCategoryID = pcParent.ProductCategoryID WHERE c.FirstName = 'David' AND soh.OrderDate > (GETDATE()-30)
  • 10. Traditional ArchitectureIssues Wouldn’t it be great if it was something like? SELECT FirstName, MiddleName, LastName, SalesOrderID, OrderDate, UnitPrice, OrderQty, LineTotal, ProductName, Color, ProductNumber, ProductModel, ProductCategory, ProductParentCategory FROM CustomerSales WHERE FirstName= 'David' AND OrderDate> (GETDATE()-30)
  • 11. Traditional ArchitecureIssues It seems that many applications cater to fast C-U-D operations, but the Reads suffer Highly normalized databases Updating a Product Name is easy What would make querying faster? Reducing JOINS Flattening out our model Heresy! Business logic and domain objects bleed through layers as a result, too.
  • 12. What Alternatives Are There? That’s where CQRS may be an option Provides for fast reads at the ‘expense’ of more expensive writes Once the data is read by the client, it’s already old A system that is eventually consistent is usually acceptable EVENTUAL CONSISTENCY! The read model for the system eventually is consistent with the system events Allows for scalability very easily Even in Azure! Encapsulates business logic in the domain Adheres strictly to CQS
  • 13. What is CQRS Command Query Responsibility Segregation Based upon Bertrand Meyer’s Command Query Separation principle: “every method should either be a command that performs an action, or a query that returns data to the caller, but not both. In other words, asking a question should not change the answer” (Meyer) In essence, commands return acknowledgement; queries return data.
  • 14. What is CQRS Recipe of CQRS Healthy serving of CQS Equal parts DDD Some denormalization for seasoning Add Event Sourcing to Taste Optionally Add Dash of NoSQL Optionally A Pinch of Cloud
  • 15. What is CQRS Taking this further, CQRS describes an architecture where commands are messages (possibly asynchronous) queries go against a read model Since commands are returning void, it allows for the message to be transformed into the read model If we’re transforming the message, why not make the read model as fast as possible? Since we’re transforming the message, perhaps we can take a few extra ticks for additional processing This flips the conventional wisdom of fast writes and slow reads Now we have fast reads and “slower” writes (since we’re writing to a denormalized store)
  • 16. What is CQRS CQRS essentially splits your application into two parts The Read Side The Command Side The Read Side requests data and receives it The Command Side issues commands (inserts, updates, deletes) and receives just an acknowledgment that it was received.
  • 17. What is CQRS (Simplified) Client Command Side Query Side Data Requested/Returned Command Issued – ack/nack Repository Command Service Domain (ARs) Event Handler Read Model Store Event Store Denormalizer
  • 18. Getting Started Steps on the Command Side Command is issued Routed to proper Domain object method Domain raises zero, one or more Events Events handled by Denormalizer to persist data to read model Each step is really one or more messages being sent
  • 19. Getting Started You can roll your own, or use a framework Several out there, including: NCQRS Lokad.CQRS Agr.CQRS on CodePlex (not much activity) Axon (Java) By using a framework, there are “extras”
  • 20. CQRS Frameworks With NCQRS (ncqrs.org), you get: CQRS support Event Sourcing Support for SQL or NoSQL event sourcing Snapshotting Not always good things If you’re doing ‘pure’ or ‘true’ CQRS, then this is good Otherwise, may be overkill Don’t depend on the framework Let the framework help you, not constrict you
  • 21. Demo – In Which David Turns To A Life-Long Desire – Buzzword Bingo Demo – BuzzyGo
  • 22. Command Side Flow Event 1 Handler 1 Read Model Command Event 2 Handler 2 Domain Event N Handler N
  • 23. Commands Simple message from the client to the back-end requesting something to be done Imperative tone CreateUser DeleteCard MarkSquare Contains enough information for the back-end to process the request No return value Maps to Aggregate Root’s constructor or method
  • 24. Domain Command maps to a AR method/ctor Business logic happens here May assume validation done on client, but can be done here Business rules applied here e.g. FREE space is in the middle and is automatically marked. Once business rules applied, data is added to events that are applied. One or more events can be applied Once event is applied, domain updates itself and is added to the event source repository Not exposed to client, generally
  • 25. Events Simple messages from domain Similar to commands But not the same Semantically different CardCreated; SquareMarked; CardWon Has enough information for event handler to write information to the read model
  • 26. Denormalizer (Handler) Handles the events applied by the domain Should NOT perform any validation or business rules Its job is to perform minimal projections and transformations of data and then send that data to the repository/datastore Repository/DataStore being updated is the read model
  • 27. Read Side Flow Request for Data Read Model Query Provider (Repo/WCFDS/etc) Client Query Results DTO
  • 28. Where Can I Use CQRS? Windows apps Services Web apps Cloud-based apps Really doesn’t matter Just depends on the problem being solved
  • 29. CQRS in the Cloud Hosting CQRS in Azure Really no different on the web side than a CQRS web app Typically, you’d want 2 roles Web Role for the UI, which also performs querying Worker Role for the Command handling Both roles can scale out as much as needed Multiple web roles with a single worker role, or vice versa or both!
  • 30. Communication in theCloud How do I issue commands from my web role? 2 typical solutions WCF service on the worker role side Use Azure storage features (blobs, queues, tables) Both have advantages and disadvantages WCF is by default synchronous, so you’ll need to design for fire-and-forget But can be easier to get up and running quickly Azure Storage has a lot of moving pieces Watch out for transaction costs!
  • 31. Using Azure Storage General flow is this Web role issues a command by dropping it in a blob container (name is GUID). Command blob name is then dropped in a queue Worker role monitors queue for work When it finds a message in the queue, it grabs blob from storage based on id in queue message Deserializes command and then sends it through normal CQRS pipeline
  • 32. CQRS in the Cloud Blob Storage Queue Controller Command Handler Domain Azure Table Storage Event(s) Repository Denormalizer Read Model
  • 33. CQRS in the Cloud ASP.NET MVC Controller Reading data is no different, going through a Repository Writing data (issuing commands) involves dropping command into Azure Queue CloudHelper class facilitates this Also provides LogMessage facility
  • 34. CQRS in the Cloud Using Azure Table Storage for logging user actions… Different than events. Want to know user behavior. Storage is huge – just watch transaction costs Consider batching log reads But you can create replays of user interaction Similar to event sourcing’s replay of events Event sourcing doesn’t capture “Cancels” or “Reads”, which may be useful from a marketing perspective
  • 35. Claim Credit for thisSession BrainCreditshttp://www.braincredits.com/Lesson/16852
  • 36. Resources CQRS InfoSite – http://cqrsinfo.com NCQRS Site –http://ncqrs.org DDD/CQRS Google Group - http://groups.google.com/group/dddcqrs UdiDahan’s CQRS article “Clarified CQRS” – http://www.udidahan.com/2009/12/09/clarified-cqrs/ RinatAbdullin’s CQRS information – http://abdullin.com/cqrs Distributed Podcast - http://distributedpodcast.com/