SlideShare a Scribd company logo
1 of 22
"SERVERLESS" CQRS USING
AZURE EVENT GRID
Using Azure Event Grid as the backbone for a serverless CQRS architecture
DUBLIN
Lets trend! …
#GlobalAzure
@Merrion
AGENDA
• What is CQRS?
• What is event sourcing?
• How to do it on Event Grid
• Q & A
WHAT IS CQRS?
Command Query
Handler Handler
Expensive and terrifying
witchcraft
WHAT IS EVENT SOURCING?
Open
Account
Open
Account
Open
Account
Deposit Money
Deposit Money
Deposit Money
Withdraw
Money
Withdraw
Money
Close Account
$10.00
$10.00
$5.00
$5.00
$10.00
Aidan
00001
Margaret
00002
Fearghal
00003
PROJECTION
Opened
Account
Deposited
Money
Withdrew
Money
$10.00 $ 3.00
Event
Type
Action
Opened
Account
Skip
Deposited
Money
Increase balance by $
Withdrew
Money
Decrease balance by $
$10.00 $ 7.00
WHAT IS EVENT GRID?
Azure Event Grid uses a pay-
per-event pricing model, so
you only pay for what you use.
Command
Query
PUTTING THEM TOGETHER…
Implementation
WHAT YOU WILL NEED…
Azure subscription
Programming environment
Domain design
GETTING DATA IN… Command
Join Team
Register for race
Complete lap
Finish Race
Start race
PERSISTING THE EVENTS
What
Happened?
Who to / for?
123
456
GETTING THE DATA OUT Query
SHOW ME THE CODE !!!
DOMAINS
League Race Runner
RUNNING A COMMAND
Command Logger
Command Handler
Event(s) Persisted
Command Validator
RUNNING A QUERY
Query Logger
Query Handler
Results Cache
DEVOPS / SYSTEM MAINTENANCE
LESSONS LEARNED
• Keep your functions small (do only one business thing per
function)
• Hook up application insights to see inside your business
application
• Be wary of knitting together domains – you can make an anti
corruption layer in Event Grid
• Be careful with what can be parallel vs what cannot. (If things
have to happen in a sequence then have them trigger each
other as a function pipeline.)
• Only write the code that only you can write (business)
THE FINANCIALS
https://azure.microsoft.com/en-us/pricing/
Q & A ?
@Merrion
Expensive and terrifying
witchcraft
A BIG thank you to Dublin Sponsors!
A BIG thank you to the 2018 Global Sponsors!
XBOX & OTHER PRIZES…
FILL IN THE FORM!
https://aka.ms/azurebootcampireland

More Related Content

Similar to Serverless cqrs using azure event grid

Power Platform24: Essential Azure for Dynamics 365 Professionals
Power Platform24: Essential Azure for Dynamics 365 ProfessionalsPower Platform24: Essential Azure for Dynamics 365 Professionals
Power Platform24: Essential Azure for Dynamics 365 ProfessionalsAli Khan
 
O365Con19 - Azure Blackbelt - Jussi Roine
O365Con19 - Azure Blackbelt - Jussi RoineO365Con19 - Azure Blackbelt - Jussi Roine
O365Con19 - Azure Blackbelt - Jussi RoineNCCOMMS
 
Write retrogames in the web and add something more with Azure
Write retrogames in the web and add something more with AzureWrite retrogames in the web and add something more with Azure
Write retrogames in the web and add something more with AzureMarco Parenzan
 
Azure 103 Certification Course
Azure 103 Certification CourseAzure 103 Certification Course
Azure 103 Certification CoursewiTTyMinds1
 
AWS Summit Milan - Opening Keynote
AWS Summit Milan - Opening KeynoteAWS Summit Milan - Opening Keynote
AWS Summit Milan - Opening KeynoteAmazon Web Services
 
Experts Live Norway - Azure Infrastructure Security
Experts Live Norway - Azure Infrastructure SecurityExperts Live Norway - Azure Infrastructure Security
Experts Live Norway - Azure Infrastructure SecurityTom Janetscheck
 
Gab2015 nicolas fonrose_costefficiencywithmicrosoftazure.pptx
Gab2015 nicolas fonrose_costefficiencywithmicrosoftazure.pptxGab2015 nicolas fonrose_costefficiencywithmicrosoftazure.pptx
Gab2015 nicolas fonrose_costefficiencywithmicrosoftazure.pptxVincent Thavonekham-Pro
 
AWS re:Invent 2016: Automating Security Event Response, from Idea to Code to ...
AWS re:Invent 2016: Automating Security Event Response, from Idea to Code to ...AWS re:Invent 2016: Automating Security Event Response, from Idea to Code to ...
AWS re:Invent 2016: Automating Security Event Response, from Idea to Code to ...Amazon Web Services
 
How Level Infinite Implemented CQRS and Event Sourcing on Top of Apache Pulsa...
How Level Infinite Implemented CQRS and Event Sourcing on Top of Apache Pulsa...How Level Infinite Implemented CQRS and Event Sourcing on Top of Apache Pulsa...
How Level Infinite Implemented CQRS and Event Sourcing on Top of Apache Pulsa...ScyllaDB
 
7.habits.every.azure.admin.must.have.v082020
7.habits.every.azure.admin.must.have.v0820207.habits.every.azure.admin.must.have.v082020
7.habits.every.azure.admin.must.have.v082020Wim Matthyssen
 
Tour to Azure Security Center
Tour to Azure Security CenterTour to Azure Security Center
Tour to Azure Security CenterLalit Rawat
 
Cloud Computing For Beginners | Cloud Computing Explained | Cloud Computing T...
Cloud Computing For Beginners | Cloud Computing Explained | Cloud Computing T...Cloud Computing For Beginners | Cloud Computing Explained | Cloud Computing T...
Cloud Computing For Beginners | Cloud Computing Explained | Cloud Computing T...Simplilearn
 
How to build a serverless helmet detection system
How to build a serverless helmet detection systemHow to build a serverless helmet detection system
How to build a serverless helmet detection systemMandar Dharmadhikari
 
Good Bye Credentials in Code, Welcome Azure Managed Identities
Good Bye Credentials in Code, Welcome Azure Managed IdentitiesGood Bye Credentials in Code, Welcome Azure Managed Identities
Good Bye Credentials in Code, Welcome Azure Managed IdentitiesKasun Kodagoda
 
Deploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data SolutionsDeploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data SolutionsMarco Parenzan
 
Azuresatpn19 - An Introduction To Azure Data Factory
Azuresatpn19 - An Introduction To Azure Data FactoryAzuresatpn19 - An Introduction To Azure Data Factory
Azuresatpn19 - An Introduction To Azure Data FactoryRiccardo Perico
 
Microsoft Azure Overview | Cloud Computing Tutorial with Azure | Azure Traini...
Microsoft Azure Overview | Cloud Computing Tutorial with Azure | Azure Traini...Microsoft Azure Overview | Cloud Computing Tutorial with Azure | Azure Traini...
Microsoft Azure Overview | Cloud Computing Tutorial with Azure | Azure Traini...Edureka!
 

Similar to Serverless cqrs using azure event grid (20)

Power Platform24: Essential Azure for Dynamics 365 Professionals
Power Platform24: Essential Azure for Dynamics 365 ProfessionalsPower Platform24: Essential Azure for Dynamics 365 Professionals
Power Platform24: Essential Azure for Dynamics 365 Professionals
 
O365Con19 - Azure Blackbelt - Jussi Roine
O365Con19 - Azure Blackbelt - Jussi RoineO365Con19 - Azure Blackbelt - Jussi Roine
O365Con19 - Azure Blackbelt - Jussi Roine
 
Write retrogames in the web and add something more with Azure
Write retrogames in the web and add something more with AzureWrite retrogames in the web and add something more with Azure
Write retrogames in the web and add something more with Azure
 
Azure 103 Certification Course
Azure 103 Certification CourseAzure 103 Certification Course
Azure 103 Certification Course
 
AWS Summit Milan - Opening Keynote
AWS Summit Milan - Opening KeynoteAWS Summit Milan - Opening Keynote
AWS Summit Milan - Opening Keynote
 
Experts Live Norway - Azure Infrastructure Security
Experts Live Norway - Azure Infrastructure SecurityExperts Live Norway - Azure Infrastructure Security
Experts Live Norway - Azure Infrastructure Security
 
Gab2015 nicolas fonrose_costefficiencywithmicrosoftazure.pptx
Gab2015 nicolas fonrose_costefficiencywithmicrosoftazure.pptxGab2015 nicolas fonrose_costefficiencywithmicrosoftazure.pptx
Gab2015 nicolas fonrose_costefficiencywithmicrosoftazure.pptx
 
AWS re:Invent 2016: Automating Security Event Response, from Idea to Code to ...
AWS re:Invent 2016: Automating Security Event Response, from Idea to Code to ...AWS re:Invent 2016: Automating Security Event Response, from Idea to Code to ...
AWS re:Invent 2016: Automating Security Event Response, from Idea to Code to ...
 
How Level Infinite Implemented CQRS and Event Sourcing on Top of Apache Pulsa...
How Level Infinite Implemented CQRS and Event Sourcing on Top of Apache Pulsa...How Level Infinite Implemented CQRS and Event Sourcing on Top of Apache Pulsa...
How Level Infinite Implemented CQRS and Event Sourcing on Top of Apache Pulsa...
 
7.habits.every.azure.admin.must.have.v082020
7.habits.every.azure.admin.must.have.v0820207.habits.every.azure.admin.must.have.v082020
7.habits.every.azure.admin.must.have.v082020
 
Tour to Azure Security Center
Tour to Azure Security CenterTour to Azure Security Center
Tour to Azure Security Center
 
Cloud Computing For Beginners | Cloud Computing Explained | Cloud Computing T...
Cloud Computing For Beginners | Cloud Computing Explained | Cloud Computing T...Cloud Computing For Beginners | Cloud Computing Explained | Cloud Computing T...
Cloud Computing For Beginners | Cloud Computing Explained | Cloud Computing T...
 
Microsoft azure
Microsoft azureMicrosoft azure
Microsoft azure
 
How to build a serverless helmet detection system
How to build a serverless helmet detection systemHow to build a serverless helmet detection system
How to build a serverless helmet detection system
 
Azure signalR
Azure signalRAzure signalR
Azure signalR
 
Good Bye Credentials in Code, Welcome Azure Managed Identities
Good Bye Credentials in Code, Welcome Azure Managed IdentitiesGood Bye Credentials in Code, Welcome Azure Managed Identities
Good Bye Credentials in Code, Welcome Azure Managed Identities
 
Deploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data SolutionsDeploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data Solutions
 
Azuresatpn19 - An Introduction To Azure Data Factory
Azuresatpn19 - An Introduction To Azure Data FactoryAzuresatpn19 - An Introduction To Azure Data Factory
Azuresatpn19 - An Introduction To Azure Data Factory
 
Microsoft Azure Overview | Cloud Computing Tutorial with Azure | Azure Traini...
Microsoft Azure Overview | Cloud Computing Tutorial with Azure | Azure Traini...Microsoft Azure Overview | Cloud Computing Tutorial with Azure | Azure Traini...
Microsoft Azure Overview | Cloud Computing Tutorial with Azure | Azure Traini...
 
AzureCostManagementAndBilling
AzureCostManagementAndBillingAzureCostManagementAndBilling
AzureCostManagementAndBilling
 

More from Duncan Jones

Hitchhiker systems deepdive
Hitchhiker systems deepdiveHitchhiker systems deepdive
Hitchhiker systems deepdiveDuncan Jones
 
Hitchhiker systems
Hitchhiker systemsHitchhiker systems
Hitchhiker systemsDuncan Jones
 
Event sourcing on azure functions code example
Event sourcing on azure functions code exampleEvent sourcing on azure functions code example
Event sourcing on azure functions code exampleDuncan Jones
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDDDuncan Jones
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven DesignDuncan Jones
 
Event sourcing continued
Event sourcing continuedEvent sourcing continued
Event sourcing continuedDuncan Jones
 
Event sourcing - from wtf to why to wow
Event sourcing - from wtf to why to wowEvent sourcing - from wtf to why to wow
Event sourcing - from wtf to why to wowDuncan Jones
 
Event sourcing from wtf to why to wow
Event sourcing   from wtf to why to wowEvent sourcing   from wtf to why to wow
Event sourcing from wtf to why to wowDuncan Jones
 
Crud or event sourcing
Crud or event sourcingCrud or event sourcing
Crud or event sourcingDuncan Jones
 
cqrs and event sourcing on Windows Azure
cqrs and event sourcing on Windows Azurecqrs and event sourcing on Windows Azure
cqrs and event sourcing on Windows AzureDuncan Jones
 
event sourcing - from wtf to why to wow
event sourcing - from wtf to why to wowevent sourcing - from wtf to why to wow
event sourcing - from wtf to why to wowDuncan Jones
 
Printing-a-NET-developers-guide-Part1
Printing-a-NET-developers-guide-Part1Printing-a-NET-developers-guide-Part1
Printing-a-NET-developers-guide-Part1Duncan Jones
 
Cqrs and the cloud
Cqrs and the cloudCqrs and the cloud
Cqrs and the cloudDuncan Jones
 

More from Duncan Jones (18)

State o' yer WAN
State o' yer WANState o' yer WAN
State o' yer WAN
 
Hitchhiker systems deepdive
Hitchhiker systems deepdiveHitchhiker systems deepdive
Hitchhiker systems deepdive
 
Hitchhiker systems
Hitchhiker systemsHitchhiker systems
Hitchhiker systems
 
Event sourcing on azure functions code example
Event sourcing on azure functions code exampleEvent sourcing on azure functions code example
Event sourcing on azure functions code example
 
Boxcar computing
Boxcar computingBoxcar computing
Boxcar computing
 
Boxcar computing
Boxcar computingBoxcar computing
Boxcar computing
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven Design
 
Event sourcing continued
Event sourcing continuedEvent sourcing continued
Event sourcing continued
 
Event sourcing - from wtf to why to wow
Event sourcing - from wtf to why to wowEvent sourcing - from wtf to why to wow
Event sourcing - from wtf to why to wow
 
3 myths of it
3 myths of it3 myths of it
3 myths of it
 
Event sourcing from wtf to why to wow
Event sourcing   from wtf to why to wowEvent sourcing   from wtf to why to wow
Event sourcing from wtf to why to wow
 
Crud or event sourcing
Crud or event sourcingCrud or event sourcing
Crud or event sourcing
 
cqrs and event sourcing on Windows Azure
cqrs and event sourcing on Windows Azurecqrs and event sourcing on Windows Azure
cqrs and event sourcing on Windows Azure
 
event sourcing - from wtf to why to wow
event sourcing - from wtf to why to wowevent sourcing - from wtf to why to wow
event sourcing - from wtf to why to wow
 
CQRS on Azure
CQRS on AzureCQRS on Azure
CQRS on Azure
 
Printing-a-NET-developers-guide-Part1
Printing-a-NET-developers-guide-Part1Printing-a-NET-developers-guide-Part1
Printing-a-NET-developers-guide-Part1
 
Cqrs and the cloud
Cqrs and the cloudCqrs and the cloud
Cqrs and the cloud
 

Recently uploaded

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
#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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Recently uploaded (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
#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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Serverless cqrs using azure event grid

Editor's Notes

  1. The key words are “CQRS” which is what we are going to do, and “Event Grid” which is how.
  2. I’ll start by describing the architecture pattern CQRS and a side track into a concept called “event sourcing” which are applicable to many different technologies then will go ahead and show how you would go about doing this on top of Event Grid.
  3. At its simplest, CQRS – command query separation of responsibilities – is an architecture whereby commands (those things that alter the state of the system) are kept separate from queries (that get the state of the system).
  4. Commands map to the things that can cause the state of your application to change – the event publishers. 1) Blob storage could be used as a sort of “in tray” that converts a file arrival into a command. 2) Event Hubs can be used to react to commands sent from other domains (or internally within this domain) 3) Custom topics
  5. Event Grid is now in “General Availability” so can be run from whichever region you have chosen for your domain. There are SDKs for a number of programming languages – C#, Python, Node.js – and the REST API means you can access it from a large range of other programming environments. You should also have some idea of the commands and events that make up your application – although it is as easy (maybe arguably easier) to add new events as your business domain requires them.
  6. For commands that have a data payload greater than the maximum size of an event (64kb) then saving the file data as a file into a designated blob storage location can trigger the event with the file location being a parameter of that command. You can envisage these blob storage locations as application in-trays. For smaller commands you can wrap the entire business data in an application specific event that goes in a custom topic For events relating to an actual race we can envisage an IoT hub being used to send data from sensors (or fit bit type devices) and here we rely on the massive throughput capabilities of IoT hub. Alternatively for an occasionally connected model you could record the events on a tablet and fire them up to your system by saving the results file to a storage location.
  7. When something (a domain event) happens and is ingested by the system we need to do a two step process in order to persist that event’s occurrence Turn the event into an event classification Append it to whichever entity’s event stream that it applies to Trigger any notifications that the event occurred that other parts of the system may be listening to The event stream can be stored as an AppendBlob, in Azure Tables, File, CosmosDB etc.
  8. To trigger a query to run, a specific query requested custom topic is passed into the system with the appropriate parameters. This is then routed to an appropriate query handler which can be an azure function, a logic app or even calling an external program using webhooks. Results are calculated by running the appropriate projections over the event streams and performing any map-reduce collation on the returned data. Results can then be distributed – either back to the caller’s application by web hooks or by email, twitter etc. using a logic app. (This could be triggered by the results being written to an “out-tray” location in Azure storage for example) This approach works best for predefined queries with matching predefined query handlers. However you can, of course, persist the output of these queries to a denormalised relational database store for more ad hoc querying.
  9. OK – a quick demo to show how these ideas sit on top of Azure Event Grid… The application for this demo represents a rudimentary system for use by a running organisation – if you are familiar with the “Meet and train league” or “Parkruns” you will know the general idea. This is split up into four domains:- League, Team, Race and Runner and each domain is represented as its own Azure functions app. There is also a linked storage account for each of these domains that holds the event streams and data snapshots for that domain.
  10. Each domain has its own distinct storage account in order to keep everything separate. Each of these has a number of containers in e.g. command logs / query logs to store the incoming commands details for debugging and audit purposes An in-tray for message payloads that are greater than 64kb Documentation to describe the commands/queries and parameters for the public interface to your domain 2) Separate event hubs for routing commands and queries around 3) Custom event grid topics for each specific command or query
  11. We send a command into the system by posting a message to the command endpoint with the event detail contained in the HTTP request body. Security is performed by having an access token passed in the HTTP request headers. The event grid topic triggers a subscription for the “Command Logger” which is an azure function which gives the command an unique identifier then writes it to the “command-log” This is so we have an audit trail of every command and can deal with failed commands. Then the command is passed to the function or functions that comprise the command handling. This could include validation and any set-up actions that need to be performed. Finally the command is turned into one or more events which are persisted to the event stream to cause the change to occur.
  12. Running a query is triggered in a very similar manner to the command – we pass a message to the event grid topic for the query type with the parameters in the HTTP request body. In addition we pass parameters to tell the query handler where and how to deliver the results when the query completes. The query parameters are logged and then passed to a query handler function. The query handler is tasked with picking up the identity group over which the query will run and then running the projection (or projections) that comprise the query before collating the results. When a query completes the results are written to a results cache (so that we do not process the same question twice) The results are then returned to where the request specified
  13. For the latest pricing, check the above link because prices do change fairly rapidly (nearly always downwards though).