SlideShare a Scribd company logo
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

More Related Content

What's hot

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
Vadym 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
 
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
Getting value from IoT, Integration and Data Analytics
 
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 Jenkins
Damien 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 Trade
Luis Colorado
 
Serverless Summit - Quiz
Serverless Summit - QuizServerless Summit - Quiz
Serverless Summit - Quiz
CodeOps Technologies LLP
 
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
Yoav 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 devops
Damien 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
 
MicroServices on Azure
MicroServices on AzureMicroServices on Azure
MicroServices on Azure
Sergey Seletsky
 
#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
Chris Richardson
 
Java PaaS Vendor Survey - September 2011
Java PaaS Vendor Survey - September 2011Java PaaS Vendor Survey - September 2011
Java PaaS Vendor Survey - September 2011
Craig 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 AWS
Amazon 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 Summit
CodeOps Technologies LLP
 
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
Getting value from IoT, Integration and Data Analytics
 
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
Craig Dickson
 

What's hot (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
 

Viewers also liked

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
 
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 Agility
ESUG
 
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
Thomas Jaskula
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event Sourcing
Mike Bild
 
Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRS
Matthew Hawkins
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven Design
Christos 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 Sourcing
Ben Wilcock
 
BDD with JBehave and Selenium
BDD with JBehave and SeleniumBDD with JBehave and Selenium
BDD with JBehave and Selenium
Nikolay Vasilev
 
Distributed systems and consistency
Distributed systems and consistencyDistributed systems and consistency
Distributed systems and consistency
seldo
 
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 Databases
Raminder Pal Singh
 

Viewers also liked (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
 

Similar to CQRS and Event Sourcing

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Nikolay Vasilev
 
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
Swiss 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 Swarm
Dmitri 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 Toolbox
Johan 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 WORLD
Aleksandr 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 AWS
Mitoc Group
 
Scala, ECS, Docker: Delayed Execution @Coursera
Scala, ECS, Docker: Delayed Execution @CourseraScala, ECS, Docker: Delayed Execution @Coursera
Scala, ECS, Docker: Delayed Execution @Coursera
C4Media
 
(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
Priyanka Aash
 
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
Thessaloniki Software Testing and QA meetup
 
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
Scott 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 Cloud
Mitoc 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 Patterns
Amazon 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 Beanstalk
Amazon Web Services
 
DevOps automation for AWS
DevOps automation for AWSDevOps automation for AWS
DevOps automation for AWS
Sachin 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 2015
Mitoc 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 more
Mitoc 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 AWS
Mitoc Group
 

Similar to CQRS and Event Sourcing (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
 

Recently uploaded

Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
Claudio Di Ciccio
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
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
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
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
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 

Recently uploaded (20)

Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
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
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
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
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 

CQRS and Event Sourcing

  • 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