SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
CQRS and Event Sourcing
Nikolay	
  Vasilev	
  
CQRS and Event Sourcing
•  Applica0on	
  Architecture	
  
•  CQRS	
  and	
  Event	
  Sourcing	
  
•  Code	
  /	
  Example	
  
•  Ques0ons	
  
•  Resources	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 2
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Application Architecture
Source:	
  [Evans,	
  DDD]	
  
Layered Architecture
•  One	
  of	
  the	
  oldest	
  paGerns	
  
•  Each	
  layer	
  could	
  couple	
  only	
  to	
  itself	
  	
  
or	
  below	
  
•  Lower	
  levels	
  could	
  loosely	
  couple	
  
to	
  upper	
  via	
  Observer	
  or	
  Mediator	
  [GoF]	
  
•  UI	
  Layer	
  
–  Only	
  renders	
  informa0on	
  
–  Example:	
  OHS	
  (Remote	
  Façade)	
  
•  Applica0on	
  Layer	
  
–  Very	
  lightweight	
  	
  
–  Building	
  Blocks:	
  Applica0on	
  Services	
  
–  Coordinate	
  opera0ons	
  over	
  	
  
Aggregates	
  (i.e.	
  express	
  Use	
  Cases)	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 4
Source:	
  [Evans,	
  DDD]	
  
Layered Architecture
•  Applica0on	
  Layer	
  
–  Register	
  Subscribers	
  for	
  Dom.	
  Events	
  	
  
–  Transac0ons,	
  Email	
  sending	
  etc.	
  
–  Devoid	
  of	
  domain	
  logic	
  
•  Domain	
  Layer	
  
–  Expressive	
  Behavioural-­‐Rich	
  Domain	
  	
  
Model	
  
•  Infrastructure	
  Layer	
  
–  Low	
  Level	
  Services	
  
–  Focus	
  on	
  technology	
  specific	
  decisions	
  
–  Persistence,	
  Messaging,	
  etc.	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 5
Source:	
  [Vernon,	
  DDD]	
  
Hexagonal Architecture (HA)
•  Also	
  known	
  as	
  “Ports	
  and	
  Adapters”	
  
•  Ports	
  
–  Outer	
  hexagon	
  (HTTP,	
  Messaging	
  etc.)	
  
–  Each	
  hexagon’s	
  side	
  represents	
  a	
  port	
  
–  Either	
  for	
  input	
  or	
  output	
  
–  Do	
  not	
  implement	
  ports(use	
  e.g.	
  Jersey)	
  
•  Adapters	
  
–  Transform	
  client’s	
  input	
  into	
  internal	
  	
  
API’s	
  “terms”	
  
–  Transform	
  internal	
  API’s	
  output	
  to	
  
input	
  suitable	
  for	
  clients	
  
–  Each	
  client	
  type	
  has	
  an	
  Adapter	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 6
Source:	
  [Vernon,	
  DDD]	
  
Hexagonal Architecture (HA)
•  Outer	
  hexagon	
  reaches	
  inner	
  
hexagon	
  via	
  applica0on’s	
  API	
  
•  Design	
  applica0on	
  inside	
  per	
  	
  
func0onal	
  requirements(use	
  cases	
  API)	
  
•  Layered	
  Architecture	
  +	
  DI	
  	
  
encourages	
  the	
  use	
  of	
  Hexagonal	
  Arch.	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 7
Event Driven Architecture (EDA)
•  Event	
  Sourcing	
  
	
  
•  Promotes,	
  detect,	
  consume	
  and	
  react	
  to	
  events	
  
	
  
•  Pipes	
  and	
  Filters	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 8
EpisodeAdded	
  
b#1,s#2	
  
SeriesRenamed	
  
b#20,s#1	
  
BrandAc0vated	
  
b#3	
  
Event Driven Architecture (EDA)
•  EDA	
  could	
  be	
  combined	
  with	
  	
  
Hexagonal	
  Architecture	
  (HA)	
  	
  
–  EDA	
  used	
  for	
  integra0on	
  
–  HA	
  used	
  for	
  Bounded	
  Contexts	
  
–  LA	
  could	
  replace	
  HA	
  as	
  well	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 9
Source:	
  [Vernon,	
  DDD]	
  
Event Driven Architecture (EDA)
•  Events	
  as	
  mechanism	
  for	
  Storage	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 10
Source:	
  [Vernon,	
  DDD]	
  
Event Driven Architecture (EDA)
•  Append-­‐only	
  architecture	
  
–  No	
  “Delete”	
  ac0on	
  
	
  
•  Distribute	
  easier	
  than	
  RDBMS	
  
–  Due	
  to	
  no	
  locks	
  
–  Sharding	
  (uses	
  only	
  Aggregate	
  keys)	
  
•  Loading	
  Objects	
  
–  Loads	
  accumulated	
  events	
  for	
  an	
  Aggregate	
  	
  
–  Performance	
  issue	
  for	
  over	
  than	
  100	
  events	
  
–  Rolling	
  Snapshots	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 11
EpisodeAdded	
  
b#1,s#2	
  
SeriesRenamed	
  
b#20,s#1	
  
SeriesRemoved	
  
b#10,s#2	
  
BrandAc0vated	
  
b#3	
  
4	
  
3	
  
snap	
  
2	
  
1	
  
CQRS
•  Command	
  and	
  Query	
  Responsibility	
  Segrega0on	
  (CQRS)	
  
•  Bertrand	
  Mayer’s	
  CQS	
  Principle	
  
–  Command:	
   	
  If	
  method	
  alters	
  the	
  state	
  should	
  not	
  return	
  value	
  (i.e.	
  returns	
  void)	
  
–  Query:	
   	
  If	
  you	
  return	
  value	
  you	
  cannot	
  mutate	
  state	
  
•  What	
  if	
  we	
  apply	
  it	
  at	
  architectural	
  level?	
  ;)	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 12
Read Service
Write Service
CQRS
•  Stereotypical	
  vs.	
  CQRS	
  Architecture	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 13
Source:	
  [Young,	
  CQRS]	
  
Stereotypical Architecture
CQRS
•  Stereotypical	
  vs.	
  CQRS	
  Architecture	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 14
Source:	
  [Young,	
  CQRS]	
  
CQRS
CQRS and Event Sourcing
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Source:	
  [Young,	
  CQRS]	
  
CQRS + ES
•  CQRS	
  +	
  EDA	
  with	
  	
  
Domain	
  Events	
  
	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 16
CQRS + ES
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 17
Source:	
  [Young,	
  CQRS]	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Code / Example
Code / Example
•  Example	
  project	
  
–  DDD-­‐CQRS	
  Sample,	
  (v.02)	
  
–  HLA:	
   	
   	
   	
  h"p://prezi.com/akrfq7jyau8w/ddd-­‐cqrs-­‐leaven-­‐v20/	
  
–  Code	
  base:	
   	
   	
  h"ps://github.com/Bo"egaIT/ddd-­‐leaven-­‐v2	
  	
  
–  User	
  Group: 	
   	
  h"ps://groups.google.com/forum/#!forum/ddd-­‐cqrs-­‐sample	
  
•  More	
  projects	
  on	
  official	
  CQRS	
  site	
  
–  hGp://cqrs.wordpress.com/examples/	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 19
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Questions?
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 21
Thank	
  you	
  for	
  your	
  aGen0on!	
  
Resources
Resources
•  [Evans,	
  DDD]	
  "Domain-­‐Driven	
  Design:	
  Tackling	
  Complexity	
  in	
  the	
  Heart	
  of	
  Sonware",	
  Eric	
  
Evans,	
  Addison	
  Wesley,	
  20/08/2003,	
  ISBN:	
  0-­‐321-­‐12521-­‐5	
  
•  [Vernon,	
  DDD],	
  "Implemen0ng	
  Domain-­‐Driven	
  Design",	
  Vaughn	
  Vernon,	
  2013,	
  	
  	
  	
  	
  ISBN-­‐10:	
  
0-­‐321-­‐83457-­‐7,	
  ISBN-­‐13:	
  978-­‐0-­‐321-­‐83457-­‐7	
  
•  [Young,	
  CQRS],	
  "CQRS	
  Documents	
  by	
  Greg	
  Young",	
  Greg	
  Young,	
  11/2010.	
  hGp://
cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf	
  
•  [Cockburn,	
  Hex	
  Arch]	
  "Hexagonal	
  Architecture",	
  h"p://alistair.cockburn.us/Hexagonal
+architecture	
  
•  [Fowler,	
  NoSQL	
  talk]	
  "NoSQL	
  maGers	
  Cologne	
  2013	
  -­‐	
  Key	
  Note:	
  NoSQL	
  Dis0lled	
  to	
  an	
  hour	
  -­‐	
  
Mar0n	
  Fowler",	
  Mar0n	
  Fowler,	
  2013,	
  h"p://vimeo.com/66052102	
  	
  
•  Domain	
  Driven	
  Design	
  Website,	
  h"p://domaindrivendesign.org/	
  
•  DDD	
  User	
  Group,	
  h"p://tech.groups.yahoo.com/group/domaindrivendesign/	
  
•  DDD	
  Community,	
  h"p://dddcommunity.org/	
  
•  CQRS	
  Official	
  Website,	
  h"p://cqrs.wordpress.com/	
  	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 23
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
CQRS + ES Page 24

Weitere ähnliche Inhalte

Was ist angesagt?

Writing less code with Serverless on AWS at AWS User Group Nairobi
Writing less code with Serverless on AWS at AWS User Group NairobiWriting less code with Serverless on AWS at AWS User Group Nairobi
Writing less code with Serverless on AWS at AWS User Group NairobiVadym Kazulkin
 
Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...Mitoc Group
 
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...Marc Müller
 
Azure dev ops integrations with Jenkins
Azure dev ops integrations with JenkinsAzure dev ops integrations with Jenkins
Azure dev ops integrations with JenkinsDamien Caro
 
Alfresco DevCon 2019 Performance Tools of the Trade
Alfresco DevCon 2019   Performance Tools of the TradeAlfresco DevCon 2019   Performance Tools of the Trade
Alfresco DevCon 2019 Performance Tools of the TradeLuis Colorado
 
Scaling wix to over 70 m users
Scaling wix to over 70 m usersScaling wix to over 70 m users
Scaling wix to over 70 m usersYoav Avrahami
 
MS Insights Brazil 2015 containers and devops
MS Insights Brazil 2015   containers and devopsMS Insights Brazil 2015   containers and devops
MS Insights Brazil 2015 containers and devopsDamien Caro
 
How would ESBs look like, if they were done today.
How would ESBs look like, if they were done today.How would ESBs look like, if they were done today.
How would ESBs look like, if they were done today.Markus Eisele
 
#JaxLondon keynote: Developing applications with a microservice architecture
#JaxLondon keynote: Developing applications with a microservice architecture#JaxLondon keynote: Developing applications with a microservice architecture
#JaxLondon keynote: Developing applications with a microservice architectureChris Richardson
 
Java PaaS Vendor Survey - September 2011
Java PaaS Vendor Survey - September 2011Java PaaS Vendor Survey - September 2011
Java PaaS Vendor Survey - September 2011Craig Dickson
 
Building a PaaS with Docker and AWS
Building a PaaS with Docker and AWSBuilding a PaaS with Docker and AWS
Building a PaaS with Docker and AWSAmazon Web Services
 
R2DBC - Good Enough for Production?
R2DBC - Good Enough for Production?R2DBC - Good Enough for Production?
R2DBC - Good Enough for Production?Olexandra Dmytrenko
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture AppDynamics
 
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Red Hat Developers
 
Serverless Architecture Patterns - Manoj Ganapathi - Serverless Summit
Serverless Architecture Patterns - Manoj Ganapathi - Serverless SummitServerless Architecture Patterns - Manoj Ganapathi - Serverless Summit
Serverless Architecture Patterns - Manoj Ganapathi - Serverless SummitCodeOps Technologies LLP
 
Amazon Webservices for Java Developers - UCI Webinar
Amazon Webservices for Java Developers - UCI WebinarAmazon Webservices for Java Developers - UCI Webinar
Amazon Webservices for Java Developers - UCI WebinarCraig Dickson
 

Was ist angesagt? (20)

Writing less code with Serverless on AWS at AWS User Group Nairobi
Writing less code with Serverless on AWS at AWS User Group NairobiWriting less code with Serverless on AWS at AWS User Group Nairobi
Writing less code with Serverless on AWS at AWS User Group Nairobi
 
Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...
 
Oracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node finalOracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node final
 
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...
 
Azure dev ops integrations with Jenkins
Azure dev ops integrations with JenkinsAzure dev ops integrations with Jenkins
Azure dev ops integrations with Jenkins
 
Alfresco DevCon 2019 Performance Tools of the Trade
Alfresco DevCon 2019   Performance Tools of the TradeAlfresco DevCon 2019   Performance Tools of the Trade
Alfresco DevCon 2019 Performance Tools of the Trade
 
Serverless Summit - Quiz
Serverless Summit - QuizServerless Summit - Quiz
Serverless Summit - Quiz
 
Scaling wix to over 70 m users
Scaling wix to over 70 m usersScaling wix to over 70 m users
Scaling wix to over 70 m users
 
MS Insights Brazil 2015 containers and devops
MS Insights Brazil 2015   containers and devopsMS Insights Brazil 2015   containers and devops
MS Insights Brazil 2015 containers and devops
 
How would ESBs look like, if they were done today.
How would ESBs look like, if they were done today.How would ESBs look like, if they were done today.
How would ESBs look like, if they were done today.
 
MicroServices on Azure
MicroServices on AzureMicroServices on Azure
MicroServices on Azure
 
#JaxLondon keynote: Developing applications with a microservice architecture
#JaxLondon keynote: Developing applications with a microservice architecture#JaxLondon keynote: Developing applications with a microservice architecture
#JaxLondon keynote: Developing applications with a microservice architecture
 
Java PaaS Vendor Survey - September 2011
Java PaaS Vendor Survey - September 2011Java PaaS Vendor Survey - September 2011
Java PaaS Vendor Survey - September 2011
 
Building a PaaS with Docker and AWS
Building a PaaS with Docker and AWSBuilding a PaaS with Docker and AWS
Building a PaaS with Docker and AWS
 
R2DBC - Good Enough for Production?
R2DBC - Good Enough for Production?R2DBC - Good Enough for Production?
R2DBC - Good Enough for Production?
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture
 
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
 
Serverless Architecture Patterns - Manoj Ganapathi - Serverless Summit
Serverless Architecture Patterns - Manoj Ganapathi - Serverless SummitServerless Architecture Patterns - Manoj Ganapathi - Serverless Summit
Serverless Architecture Patterns - Manoj Ganapathi - Serverless Summit
 
Oracle OpenWorld 2014 Review Part Four - PaaS Middleware
Oracle OpenWorld 2014 Review Part Four - PaaS MiddlewareOracle OpenWorld 2014 Review Part Four - PaaS Middleware
Oracle OpenWorld 2014 Review Part Four - PaaS Middleware
 
Amazon Webservices for Java Developers - UCI Webinar
Amazon Webservices for Java Developers - UCI WebinarAmazon Webservices for Java Developers - UCI Webinar
Amazon Webservices for Java Developers - UCI Webinar
 

Andere mochten auch

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 DDDDennis Doomen
 
DDD, CQRS & ES lessons learned (Gitte Vermeiren)
DDD, CQRS & ES lessons learned (Gitte Vermeiren)DDD, CQRS & ES lessons learned (Gitte Vermeiren)
DDD, CQRS & ES lessons learned (Gitte Vermeiren)Visug
 
SciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with AgilitySciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with AgilityESUG
 
CQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architectureCQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architectureThomas Jaskula
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event SourcingMike Bild
 
Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRSMatthew Hawkins
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven DesignChristos Tsakostas
 
Microservice Architecture with CQRS and Event Sourcing
Microservice Architecture with CQRS and Event SourcingMicroservice Architecture with CQRS and Event Sourcing
Microservice Architecture with CQRS and Event SourcingBen Wilcock
 
BDD with JBehave and Selenium
BDD with JBehave and SeleniumBDD with JBehave and Selenium
BDD with JBehave and SeleniumNikolay Vasilev
 
Distributed systems and consistency
Distributed systems and consistencyDistributed systems and consistency
Distributed systems and consistencyseldo
 
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...
Developing event-driven microservices with event sourcing and CQRS  (svcc, sv...Developing event-driven microservices with event sourcing and CQRS  (svcc, sv...
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...Chris Richardson
 
Single User v/s Multi User Databases
Single User v/s Multi User DatabasesSingle User v/s Multi User Databases
Single User v/s Multi User DatabasesRaminder Pal Singh
 

Andere mochten auch (12)

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
 
DDD, CQRS & ES lessons learned (Gitte Vermeiren)
DDD, CQRS & ES lessons learned (Gitte Vermeiren)DDD, CQRS & ES lessons learned (Gitte Vermeiren)
DDD, CQRS & ES lessons learned (Gitte Vermeiren)
 
SciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with AgilitySciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with Agility
 
CQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architectureCQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architecture
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event Sourcing
 
Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRS
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven Design
 
Microservice Architecture with CQRS and Event Sourcing
Microservice Architecture with CQRS and Event SourcingMicroservice Architecture with CQRS and Event Sourcing
Microservice Architecture with CQRS and Event Sourcing
 
BDD with JBehave and Selenium
BDD with JBehave and SeleniumBDD with JBehave and Selenium
BDD with JBehave and Selenium
 
Distributed systems and consistency
Distributed systems and consistencyDistributed systems and consistency
Distributed systems and consistency
 
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...
Developing event-driven microservices with event sourcing and CQRS  (svcc, sv...Developing event-driven microservices with event sourcing and CQRS  (svcc, sv...
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...
 
Single User v/s Multi User Databases
Single User v/s Multi User DatabasesSingle User v/s Multi User Databases
Single User v/s Multi User Databases
 

Ähnlich wie CQRS and Event Sourcing Architecture Explained

Project "Babelfish" - A data warehouse to attack complexity
 Project "Babelfish" - A data warehouse to attack complexity Project "Babelfish" - A data warehouse to attack complexity
Project "Babelfish" - A data warehouse to attack complexitySwiss Big Data User Group
 
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmGenomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmDmitri Zimine
 
OpenStack cloud for ConoHa, Z.com and GMO AppsCloud in okinawa opendays 2015 ...
OpenStack cloud for ConoHa, Z.com and GMO AppsCloud in okinawa opendays 2015 ...OpenStack cloud for ConoHa, Z.com and GMO AppsCloud in okinawa opendays 2015 ...
OpenStack cloud for ConoHa, Z.com and GMO AppsCloud in okinawa opendays 2015 ...Naoto Gohko
 
Azure Serverless Toolbox
Azure Serverless ToolboxAzure Serverless Toolbox
Azure Serverless ToolboxJohan Eriksson
 
HOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDHOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDAleksandr Maklakov
 
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...VarunNehra
 
Build Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSBuild Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSMitoc Group
 
Scala, ECS, Docker: Delayed Execution @Coursera
Scala, ECS, Docker: Delayed Execution @CourseraScala, ECS, Docker: Delayed Execution @Coursera
Scala, ECS, Docker: Delayed Execution @CourseraC4Media
 
(SACON) Satish Sreenivasaiah - DevSecOps Tools and Beyond
(SACON) Satish Sreenivasaiah - DevSecOps Tools and Beyond(SACON) Satish Sreenivasaiah - DevSecOps Tools and Beyond
(SACON) Satish Sreenivasaiah - DevSecOps Tools and BeyondPriyanka Aash
 
20171122 aws usergrp_coretech-spn-cicd-aws-v01
20171122 aws usergrp_coretech-spn-cicd-aws-v0120171122 aws usergrp_coretech-spn-cicd-aws-v01
20171122 aws usergrp_coretech-spn-cicd-aws-v01Scott Miao
 
Microservices Architecture for Web Applications using Amazon AWS Cloud
Microservices Architecture for Web Applications using Amazon AWS CloudMicroservices Architecture for Web Applications using Amazon AWS Cloud
Microservices Architecture for Web Applications using Amazon AWS CloudMitoc Group
 
(ARC309) Getting to Microservices: Cloud Architecture Patterns
(ARC309) Getting to Microservices: Cloud Architecture Patterns(ARC309) Getting to Microservices: Cloud Architecture Patterns
(ARC309) Getting to Microservices: Cloud Architecture PatternsAmazon Web Services
 
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic BeanstalkAmazon Web Services
 
DevOps automation for AWS
DevOps automation for AWSDevOps automation for AWS
DevOps automation for AWSSachin Dole
 
ARC201 Microservices Architecture @ AWS re:Invent 2015
ARC201 Microservices Architecture @ AWS re:Invent 2015ARC201 Microservices Architecture @ AWS re:Invent 2015
ARC201 Microservices Architecture @ AWS re:Invent 2015Mitoc Group
 
Microservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and moreMicroservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and moreMitoc Group
 
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...Amazon Web Services
 
Microservices Architecture for Digital Platforms using Serverless AWS
Microservices Architecture for Digital Platforms using Serverless AWSMicroservices Architecture for Digital Platforms using Serverless AWS
Microservices Architecture for Digital Platforms using Serverless AWSMitoc Group
 

Ähnlich wie CQRS and Event Sourcing Architecture Explained (20)

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Project "Babelfish" - A data warehouse to attack complexity
 Project "Babelfish" - A data warehouse to attack complexity Project "Babelfish" - A data warehouse to attack complexity
Project "Babelfish" - A data warehouse to attack complexity
 
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmGenomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
 
OpenStack cloud for ConoHa, Z.com and GMO AppsCloud in okinawa opendays 2015 ...
OpenStack cloud for ConoHa, Z.com and GMO AppsCloud in okinawa opendays 2015 ...OpenStack cloud for ConoHa, Z.com and GMO AppsCloud in okinawa opendays 2015 ...
OpenStack cloud for ConoHa, Z.com and GMO AppsCloud in okinawa opendays 2015 ...
 
Azure Serverless Toolbox
Azure Serverless ToolboxAzure Serverless Toolbox
Azure Serverless Toolbox
 
HOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDHOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLD
 
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
 
Build Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSBuild Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWS
 
Scala, ECS, Docker: Delayed Execution @Coursera
Scala, ECS, Docker: Delayed Execution @CourseraScala, ECS, Docker: Delayed Execution @Coursera
Scala, ECS, Docker: Delayed Execution @Coursera
 
(SACON) Satish Sreenivasaiah - DevSecOps Tools and Beyond
(SACON) Satish Sreenivasaiah - DevSecOps Tools and Beyond(SACON) Satish Sreenivasaiah - DevSecOps Tools and Beyond
(SACON) Satish Sreenivasaiah - DevSecOps Tools and Beyond
 
Kubernetes + Jenkins X: a Cloud Native Approach
Kubernetes + Jenkins X: a Cloud Native ApproachKubernetes + Jenkins X: a Cloud Native Approach
Kubernetes + Jenkins X: a Cloud Native Approach
 
20171122 aws usergrp_coretech-spn-cicd-aws-v01
20171122 aws usergrp_coretech-spn-cicd-aws-v0120171122 aws usergrp_coretech-spn-cicd-aws-v01
20171122 aws usergrp_coretech-spn-cicd-aws-v01
 
Microservices Architecture for Web Applications using Amazon AWS Cloud
Microservices Architecture for Web Applications using Amazon AWS CloudMicroservices Architecture for Web Applications using Amazon AWS Cloud
Microservices Architecture for Web Applications using Amazon AWS Cloud
 
(ARC309) Getting to Microservices: Cloud Architecture Patterns
(ARC309) Getting to Microservices: Cloud Architecture Patterns(ARC309) Getting to Microservices: Cloud Architecture Patterns
(ARC309) Getting to Microservices: Cloud Architecture Patterns
 
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
 
DevOps automation for AWS
DevOps automation for AWSDevOps automation for AWS
DevOps automation for AWS
 
ARC201 Microservices Architecture @ AWS re:Invent 2015
ARC201 Microservices Architecture @ AWS re:Invent 2015ARC201 Microservices Architecture @ AWS re:Invent 2015
ARC201 Microservices Architecture @ AWS re:Invent 2015
 
Microservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and moreMicroservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and more
 
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...
 
Microservices Architecture for Digital Platforms using Serverless AWS
Microservices Architecture for Digital Platforms using Serverless AWSMicroservices Architecture for Digital Platforms using Serverless AWS
Microservices Architecture for Digital Platforms using Serverless AWS
 

Kürzlich hochgeladen

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Kürzlich hochgeladen (20)

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

CQRS and Event Sourcing Architecture Explained

  • 1. CQRS and Event Sourcing Nikolay  Vasilev  
  • 2. CQRS and Event Sourcing •  Applica0on  Architecture   •  CQRS  and  Event  Sourcing   •  Code  /  Example   •  Ques0ons   •  Resources   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 2
  • 3. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Application Architecture
  • 4. Source:  [Evans,  DDD]   Layered Architecture •  One  of  the  oldest  paGerns   •  Each  layer  could  couple  only  to  itself     or  below   •  Lower  levels  could  loosely  couple   to  upper  via  Observer  or  Mediator  [GoF]   •  UI  Layer   –  Only  renders  informa0on   –  Example:  OHS  (Remote  Façade)   •  Applica0on  Layer   –  Very  lightweight     –  Building  Blocks:  Applica0on  Services   –  Coordinate  opera0ons  over     Aggregates  (i.e.  express  Use  Cases)   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 4
  • 5. Source:  [Evans,  DDD]   Layered Architecture •  Applica0on  Layer   –  Register  Subscribers  for  Dom.  Events     –  Transac0ons,  Email  sending  etc.   –  Devoid  of  domain  logic   •  Domain  Layer   –  Expressive  Behavioural-­‐Rich  Domain     Model   •  Infrastructure  Layer   –  Low  Level  Services   –  Focus  on  technology  specific  decisions   –  Persistence,  Messaging,  etc.   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 5
  • 6. Source:  [Vernon,  DDD]   Hexagonal Architecture (HA) •  Also  known  as  “Ports  and  Adapters”   •  Ports   –  Outer  hexagon  (HTTP,  Messaging  etc.)   –  Each  hexagon’s  side  represents  a  port   –  Either  for  input  or  output   –  Do  not  implement  ports(use  e.g.  Jersey)   •  Adapters   –  Transform  client’s  input  into  internal     API’s  “terms”   –  Transform  internal  API’s  output  to   input  suitable  for  clients   –  Each  client  type  has  an  Adapter   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 6
  • 7. Source:  [Vernon,  DDD]   Hexagonal Architecture (HA) •  Outer  hexagon  reaches  inner   hexagon  via  applica0on’s  API   •  Design  applica0on  inside  per     func0onal  requirements(use  cases  API)   •  Layered  Architecture  +  DI     encourages  the  use  of  Hexagonal  Arch.   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 7
  • 8. Event Driven Architecture (EDA) •  Event  Sourcing     •  Promotes,  detect,  consume  and  react  to  events     •  Pipes  and  Filters   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 8 EpisodeAdded   b#1,s#2   SeriesRenamed   b#20,s#1   BrandAc0vated   b#3  
  • 9. Event Driven Architecture (EDA) •  EDA  could  be  combined  with     Hexagonal  Architecture  (HA)     –  EDA  used  for  integra0on   –  HA  used  for  Bounded  Contexts   –  LA  could  replace  HA  as  well   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 9 Source:  [Vernon,  DDD]  
  • 10. Event Driven Architecture (EDA) •  Events  as  mechanism  for  Storage   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 10 Source:  [Vernon,  DDD]  
  • 11. Event Driven Architecture (EDA) •  Append-­‐only  architecture   –  No  “Delete”  ac0on     •  Distribute  easier  than  RDBMS   –  Due  to  no  locks   –  Sharding  (uses  only  Aggregate  keys)   •  Loading  Objects   –  Loads  accumulated  events  for  an  Aggregate     –  Performance  issue  for  over  than  100  events   –  Rolling  Snapshots   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 11 EpisodeAdded   b#1,s#2   SeriesRenamed   b#20,s#1   SeriesRemoved   b#10,s#2   BrandAc0vated   b#3   4   3   snap   2   1  
  • 12. CQRS •  Command  and  Query  Responsibility  Segrega0on  (CQRS)   •  Bertrand  Mayer’s  CQS  Principle   –  Command:    If  method  alters  the  state  should  not  return  value  (i.e.  returns  void)   –  Query:    If  you  return  value  you  cannot  mutate  state   •  What  if  we  apply  it  at  architectural  level?  ;)   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 12 Read Service Write Service
  • 13. CQRS •  Stereotypical  vs.  CQRS  Architecture   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 13 Source:  [Young,  CQRS]   Stereotypical Architecture
  • 14. CQRS •  Stereotypical  vs.  CQRS  Architecture   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 14 Source:  [Young,  CQRS]   CQRS
  • 15. CQRS and Event Sourcing Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0
  • 16. Source:  [Young,  CQRS]   CQRS + ES •  CQRS  +  EDA  with     Domain  Events     Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 16
  • 17. CQRS + ES Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 17 Source:  [Young,  CQRS]  
  • 18. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Code / Example
  • 19. Code / Example •  Example  project   –  DDD-­‐CQRS  Sample,  (v.02)   –  HLA:        h"p://prezi.com/akrfq7jyau8w/ddd-­‐cqrs-­‐leaven-­‐v20/   –  Code  base:      h"ps://github.com/Bo"egaIT/ddd-­‐leaven-­‐v2     –  User  Group:    h"ps://groups.google.com/forum/#!forum/ddd-­‐cqrs-­‐sample   •  More  projects  on  official  CQRS  site   –  hGp://cqrs.wordpress.com/examples/   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 19
  • 20. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Questions?
  • 21. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 21 Thank  you  for  your  aGen0on!  
  • 23. Resources •  [Evans,  DDD]  "Domain-­‐Driven  Design:  Tackling  Complexity  in  the  Heart  of  Sonware",  Eric   Evans,  Addison  Wesley,  20/08/2003,  ISBN:  0-­‐321-­‐12521-­‐5   •  [Vernon,  DDD],  "Implemen0ng  Domain-­‐Driven  Design",  Vaughn  Vernon,  2013,          ISBN-­‐10:   0-­‐321-­‐83457-­‐7,  ISBN-­‐13:  978-­‐0-­‐321-­‐83457-­‐7   •  [Young,  CQRS],  "CQRS  Documents  by  Greg  Young",  Greg  Young,  11/2010.  hGp:// cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf   •  [Cockburn,  Hex  Arch]  "Hexagonal  Architecture",  h"p://alistair.cockburn.us/Hexagonal +architecture   •  [Fowler,  NoSQL  talk]  "NoSQL  maGers  Cologne  2013  -­‐  Key  Note:  NoSQL  Dis0lled  to  an  hour  -­‐   Mar0n  Fowler",  Mar0n  Fowler,  2013,  h"p://vimeo.com/66052102     •  Domain  Driven  Design  Website,  h"p://domaindrivendesign.org/   •  DDD  User  Group,  h"p://tech.groups.yahoo.com/group/domaindrivendesign/   •  DDD  Community,  h"p://dddcommunity.org/   •  CQRS  Official  Website,  h"p://cqrs.wordpress.com/     Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 23
  • 24. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 CQRS + ES Page 24