SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Beyond DDD 101 A practice report on building multi
bounded context CQRS/ES applications
Jan Galinski & Simon Zambrovski
Amsterdam, 23.09.2022
1
Who we are
Jan Galinski
Simon Zambrovski
23.09.2022, AxonIQCon 2022 2
Consultants @ holisticon
Backend developers, software architects
DDD, CQRS/ES, Axon Framework, Spring, Kotlin, Java
What is Holisticon
• IT Consulting
• Hamburg, Hannover, Kiel
• Cool crew
• Best Employer 2022
in Hamburg
• We are hiring!
23.09.2022, AxonIQCon 2022 3
BESTE BERATUNG – BESTE SOFTWARE
Motivation
• We love architecture
• DDD
• CQRS
• Event Sourcing
• Large-scale applications running on JVM
• We love Axon Framework
• We want to share our experience
23.09.2022, AxonIQCon 2022 4
https://www.pexels.com/de-de/foto/verschiedene-puzzlespiele-1586951/
Foundation – Theory - DDD
• Set of principles for system implementation
• Requirement Engineering
• Domain Modeling
• Strategic Design
• Bounded Context identification
• Context Mapping
• Design
• Ubiquitous Language
• Design Patterns
23.09.2022, AxonIQCon 2022 5
https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215
Foundation – Theory – DDD Patterns
• Modeling of Bounded Context relationships (for Microservices)
• Separate Ways
• Upstream/Downstream
• Open Host Service + Published Language
• Anti Corruption Layer
• Tactical Design
• Value Object, Entity, Aggregate, Aggregate Root
• Domain Service, Factory, Repository
• Domain Event
• Saga Pattern
23.09.2022, AxonIQCon 2022 6
Foundation – Theory – CQRS/ES
• Command Query Responsibility Segregation Pattern
• Reduce complexity of Domain model
• Separate Command model from Query model (optimized)
• Scale-out independently
• Event Sourcing Persistence Strategy
• Store Domain Events (versus store State)
• Derive State from Domain Event stream
• CQRS/ES
• Use Domain Events to communicate between Command and Query models
• Allow late stream consumption (stream replay)
23.09.2022, AxonIQCon 2022 7
Domain
Foundation - Onion Architecture
Driving
(primary)
Adapter
Driven
(secondary)
Adapter
Domain
Model
Ring
Port Port
Application Service Ring
Infrastructure Ring
23.09.2022, AxonIQCon 2022 8
Axon Framework 101
• FOSS framework in Java for building DDD CQRS(/ES) systems
• Explicit message concept
• 3 buses for decoupling
• Command -> Addressed intent of a change, may fail, unicast
• Event -> Fact, broadcast
• Query -> Request for data, has result, multicast
• Domain Model Segregation (implements CQRS)
• Event Sourcing implementation (different Event Stores)
• Separation of business logic from configuration
23.09.2022, AxonIQCon 2022 9
https://developer.axoniq.io/download
Possible Architecture using Axon Framework
23.09.2022, AxonIQCon 2022 10
https://docs.axoniq.io/reference-guide/
System evolution in single context
• Build components using buses for communication
• Start with modulith
• Distribute along buses
• Scale out projections
• Build new projections later
• Change infrastructure
23.09.2022, AxonIQCon 2022 11
Domain Core
Onion Architecture with Axon Framework
REST
Adapter
Query Model
Command Model
Command
Gateway
Query
Gateway
Projection
Repository
Aggregate
Repository
Query
Bus
Comma
nd Bus
Event
Bus
Pivotal
Event
Bus
Pivotal
Event
Bus
Domain
Event
Bus
Domain
Comma
nd Bus
Query
Bus
Saga
23.09.2022, AxonIQCon 2022 12
23.09.2022, AxonIQCon 2022 13
https://www.pexels.com/de-de/foto/mann-frustration-kopfschmerzen-brille-9843268/
Domain Core
Onion Architecture with Axon Framework
REST
Adapter
Query Model
Command Model
Command
Gateway
Query
Gateway
Projection
Repository
Aggregate
Repository
Query
Bus
Comma
nd Bus
Event
Bus
Pivotal
Event
Bus
Pivotal
Event
Bus
Domain
Event
Bus
Domain
Comma
nd Bus
Query
Bus
Saga
23.09.2022, AxonIQCon 2022 14
Simplified context building block
Query Model
Command Model
Query
Bus
Comma
nd Bus
Event
Bus
Event
Bus
Comma
nd Bus
Query
Bus
Saga
23.09.2022, AxonIQCon 2022 15
Patterns
23.09.2022, AxonIQCon 2022 16
Q
S
C
? Q
S
C
Q
Master Data Query
Q
S
D U
23.09.2022, AxonIQCon 2022 17
„You know some things that I need to know, please tell me!“
Query
Master Data Query
Q
S
Q
D U
23.09.2022, AxonIQCon 2022 18
Query
Benefits
• Simple (~ GET)
• No redundancy (GDPR)
• Encapsulate complex business
logic
Challenges
• Runtime dependency
• Trap: Building specialized
projections for other teams
• Outdated data, caching
Trigger a query
C
U D
23.09.2022, AxonIQCon 2022 19
Q Q
„I made some changes … ask me if you want more details.“
Query
C‘
Trigger a query
C
U D
23.09.2022, AxonIQCon 2022 20
Q Q
Query
Benefits
•„Cache invalidation“
Challenges
•Runtime dependency*
•Load (query avalanche)
Query Aggregator
C
Q
U D
23.09.2022, AxonIQCon 2022 21
„Here is some data that could be useful to build your projection.“
Query
Q‘
C‘
Query Aggregator
C
Q
U D
23.09.2022, AxonIQCon 2022 22
Query
Benefits
• Decoupling
• Build complex projections
from other contexts
Challenges
• Event Payload definition
• Payload interpretation
Reacting to Fact
C
S
C
U D
23.09.2022, AxonIQCon 2022 23
Command
„I changed some things … deal with it.“
C‘ C‘
Reacting to Fact
C
S
C
U D
23.09.2022, AxonIQCon 2022 24
Command
Benefits
• Simple
• Decoupled
• Event Driven
Challenges
• Downstream Command model
must follow
• Command-Event-Command
bridge
Downstream Saga
C
S
C
D U
23.09.2022, AxonIQCon 2022 25
Command
„I need you to do something for me, and I need the result.“
C*
C‘ C‘
Downstream Saga
C
S
C
D U
23.09.2022, AxonIQCon 2022 26
Command
Benefits
• Build for failure
• Delegate sub processes
Challenges
• Compensation
• Complex for more than
one context
External Orchestrator
C
S
C
D U
U
23.09.2022, AxonIQCon 2022 27
Command
C*
C* C‘
C‘
„If you two cannot handle it, let me take control.“
External Orchestrator
C
S
C
D U
U
23.09.2022, AxonIQCon 2022 28
Command
Benefits
• Build for failure
• Separate ways
• Business process
Challenges
• Compensation
• Complex for more than one
context
Key Takeaways
• Domain Driven Design
• Start with Strategic Design
• Do proper Context Mapping – Relationships!
• CQRS/ES
• Use Command / Event / Query abstractions („Events only“ is not enough)
• Use Axon Framework if working on JVM
• Practical
• Start with a modulith
• Build evolutionary
• Distribute on demand
23.09.2022, AxonIQCon 2022 29
Thank you... Questions?
• Holisticon AG
• https://holisticon.de/
• Jan
• https://about.me/jangalinski
• Simon
• https://about.me/zambrovski
• Axon Framework
• https://developer.axoniq.io/
23.09.2022, AxonIQCon 2022 30
https://www.pexels.com/de-de/foto/fragezeichen-auf-zerknittertem-papier-5428826/

Weitere ähnliche Inhalte

Was ist angesagt?

Chef for DevOps - an Introduction
Chef for DevOps - an IntroductionChef for DevOps - an Introduction
Chef for DevOps - an IntroductionSanjeev Sharma
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREMicroservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREAraf Karsh Hamid
 
Microservices Architecture Part 2 Event Sourcing and Saga
Microservices Architecture Part 2 Event Sourcing and SagaMicroservices Architecture Part 2 Event Sourcing and Saga
Microservices Architecture Part 2 Event Sourcing and SagaAraf Karsh Hamid
 
Microservices + Events + Docker = A Perfect Trio (dockercon)
Microservices + Events + Docker = A Perfect Trio (dockercon)Microservices + Events + Docker = A Perfect Trio (dockercon)
Microservices + Events + Docker = A Perfect Trio (dockercon)Chris Richardson
 
Building Event Driven (Micro)services with Apache Kafka
Building Event Driven (Micro)services with Apache KafkaBuilding Event Driven (Micro)services with Apache Kafka
Building Event Driven (Micro)services with Apache KafkaGuido Schmutz
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopBob Killen
 
Introducing Domain Driven Design - codemash
Introducing Domain Driven Design - codemashIntroducing Domain Driven Design - codemash
Introducing Domain Driven Design - codemashSteven Smith
 
Architecture for Flow w/ Wardley Mapping, Domain-Driven Design, and Team Topo...
Architecture for Flow w/ Wardley Mapping, Domain-Driven Design, and Team Topo...Architecture for Flow w/ Wardley Mapping, Domain-Driven Design, and Team Topo...
Architecture for Flow w/ Wardley Mapping, Domain-Driven Design, and Team Topo...Susanne Kaiser
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQAraf Karsh Hamid
 
Intro to AWS Developer Tools, featuring AWS CodeStar
Intro to AWS Developer Tools, featuring AWS CodeStarIntro to AWS Developer Tools, featuring AWS CodeStar
Intro to AWS Developer Tools, featuring AWS CodeStarAmazon Web Services
 
Introduction To Microservices
Introduction To MicroservicesIntroduction To Microservices
Introduction To MicroservicesLalit Kale
 
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
 
Microservices Part 3 Service Mesh and Kafka
Microservices Part 3 Service Mesh and KafkaMicroservices Part 3 Service Mesh and Kafka
Microservices Part 3 Service Mesh and KafkaAraf Karsh Hamid
 
Event driven microservices with axon and spring boot-excitingly boring
Event driven microservices with axon and spring boot-excitingly boringEvent driven microservices with axon and spring boot-excitingly boring
Event driven microservices with axon and spring boot-excitingly boringAllard Buijze
 

Was ist angesagt? (20)

AKS
AKSAKS
AKS
 
Chef for DevOps - an Introduction
Chef for DevOps - an IntroductionChef for DevOps - an Introduction
Chef for DevOps - an Introduction
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREMicroservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SRE
 
Microservices Architecture Part 2 Event Sourcing and Saga
Microservices Architecture Part 2 Event Sourcing and SagaMicroservices Architecture Part 2 Event Sourcing and Saga
Microservices Architecture Part 2 Event Sourcing and Saga
 
Microservices + Events + Docker = A Perfect Trio (dockercon)
Microservices + Events + Docker = A Perfect Trio (dockercon)Microservices + Events + Docker = A Perfect Trio (dockercon)
Microservices + Events + Docker = A Perfect Trio (dockercon)
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Building Event Driven (Micro)services with Apache Kafka
Building Event Driven (Micro)services with Apache KafkaBuilding Event Driven (Micro)services with Apache Kafka
Building Event Driven (Micro)services with Apache Kafka
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes Workshop
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
Architecture: Microservices
Architecture: MicroservicesArchitecture: Microservices
Architecture: Microservices
 
Introducing Domain Driven Design - codemash
Introducing Domain Driven Design - codemashIntroducing Domain Driven Design - codemash
Introducing Domain Driven Design - codemash
 
Architecture for Flow w/ Wardley Mapping, Domain-Driven Design, and Team Topo...
Architecture for Flow w/ Wardley Mapping, Domain-Driven Design, and Team Topo...Architecture for Flow w/ Wardley Mapping, Domain-Driven Design, and Team Topo...
Architecture for Flow w/ Wardley Mapping, Domain-Driven Design, and Team Topo...
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQ
 
Intro to AWS Developer Tools, featuring AWS CodeStar
Intro to AWS Developer Tools, featuring AWS CodeStarIntro to AWS Developer Tools, featuring AWS CodeStar
Intro to AWS Developer Tools, featuring AWS CodeStar
 
AWS Lambda in C#
AWS Lambda in C#AWS Lambda in C#
AWS Lambda in C#
 
Introduction To Microservices
Introduction To MicroservicesIntroduction To Microservices
Introduction To Microservices
 
Cqrs api v2
Cqrs api v2Cqrs api v2
Cqrs api v2
 
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
 
Microservices Part 3 Service Mesh and Kafka
Microservices Part 3 Service Mesh and KafkaMicroservices Part 3 Service Mesh and Kafka
Microservices Part 3 Service Mesh and Kafka
 
Event driven microservices with axon and spring boot-excitingly boring
Event driven microservices with axon and spring boot-excitingly boringEvent driven microservices with axon and spring boot-excitingly boring
Event driven microservices with axon and spring boot-excitingly boring
 

Ähnlich wie AxonIQCon22 - Beyond DDD 101 - Zambrovski-Galinski.pptx

Building Cloud-Native Applications in MiCADO - MiCADO webinar No.2/4 - 09/2019
Building Cloud-Native Applications in MiCADO - MiCADO webinar No.2/4 - 09/2019Building Cloud-Native Applications in MiCADO - MiCADO webinar No.2/4 - 09/2019
Building Cloud-Native Applications in MiCADO - MiCADO webinar No.2/4 - 09/2019Project COLA
 
Bridging the Instance V1 Marks and Encryptions
Bridging the Instance V1 Marks and EncryptionsBridging the Instance V1 Marks and Encryptions
Bridging the Instance V1 Marks and EncryptionsBrij Consulting, LLC
 
From desktop to the cloud with forge
From desktop to the cloud with forgeFrom desktop to the cloud with forge
From desktop to the cloud with forgefpm2015
 
Cloud Computing-10012021-v4-hosting by Rinko Kabiraj.ppt
Cloud Computing-10012021-v4-hosting by Rinko Kabiraj.pptCloud Computing-10012021-v4-hosting by Rinko Kabiraj.ppt
Cloud Computing-10012021-v4-hosting by Rinko Kabiraj.ppttanim26
 
Forge - DevCon 2016: From Desktop to the Cloud with Forge
Forge - DevCon 2016: From Desktop to the Cloud with ForgeForge - DevCon 2016: From Desktop to the Cloud with Forge
Forge - DevCon 2016: From Desktop to the Cloud with ForgeAutodesk
 
CCCNA17 Introduction
CCCNA17 IntroductionCCCNA17 Introduction
CCCNA17 IntroductionShapeBlue
 
Basics of Cloud Computing- 5 th semester
Basics of Cloud Computing- 5 th semesterBasics of Cloud Computing- 5 th semester
Basics of Cloud Computing- 5 th semestersadas88
 
Crossover Conveyance V1 Glass Path
Crossover Conveyance V1 Glass PathCrossover Conveyance V1 Glass Path
Crossover Conveyance V1 Glass PathBrij Consulting, LLC
 
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...TRESOR: The modular cloud - Building a domain specific cloud platform with OS...
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...mfrancis
 
All Streams Ahead! ksqlDB Workshop ANZ
All Streams Ahead! ksqlDB Workshop ANZAll Streams Ahead! ksqlDB Workshop ANZ
All Streams Ahead! ksqlDB Workshop ANZconfluent
 
AWS Cloud Computing workshop 30-31st May Bangalore
AWS Cloud Computing workshop 30-31st May BangaloreAWS Cloud Computing workshop 30-31st May Bangalore
AWS Cloud Computing workshop 30-31st May BangaloreSudhir Nair
 
AWS Cloud Computing workshop 30-31 May Bangalore
AWS Cloud Computing workshop 30-31 May BangaloreAWS Cloud Computing workshop 30-31 May Bangalore
AWS Cloud Computing workshop 30-31 May BangaloreBOOSTurSKILLS
 
AWS Cloud Computing workshop 30 31st May Bangalore
AWS Cloud Computing workshop 30 31st May BangaloreAWS Cloud Computing workshop 30 31st May Bangalore
AWS Cloud Computing workshop 30 31st May BangaloreSudhir Nair
 
AWS Cloud Computing workshop 30-31 May Bangalore
AWS Cloud Computing workshop 30-31 May BangaloreAWS Cloud Computing workshop 30-31 May Bangalore
AWS Cloud Computing workshop 30-31 May BangaloreSudhir Nair
 
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...idsecconf
 
code lab live Google Cloud Endpoints [DevFest 2015 Bari]
code lab live Google Cloud Endpoints [DevFest 2015 Bari]code lab live Google Cloud Endpoints [DevFest 2015 Bari]
code lab live Google Cloud Endpoints [DevFest 2015 Bari]Nicola Policoro
 
Experiments with Complex Scientific Applications on Hybrid Cloud Infrastructures
Experiments with Complex Scientific Applications on Hybrid Cloud InfrastructuresExperiments with Complex Scientific Applications on Hybrid Cloud Infrastructures
Experiments with Complex Scientific Applications on Hybrid Cloud InfrastructuresRafael Ferreira da Silva
 
Cloudstack container service
Cloudstack container serviceCloudstack container service
Cloudstack container serviceShapeBlue
 
Lightening the burden of cloud resources administration: from VMs to Functions
Lightening the burden of cloud resources administration: from VMs to FunctionsLightening the burden of cloud resources administration: from VMs to Functions
Lightening the burden of cloud resources administration: from VMs to FunctionsEUBrasilCloudFORUM .
 

Ähnlich wie AxonIQCon22 - Beyond DDD 101 - Zambrovski-Galinski.pptx (20)

Building Cloud-Native Applications in MiCADO - MiCADO webinar No.2/4 - 09/2019
Building Cloud-Native Applications in MiCADO - MiCADO webinar No.2/4 - 09/2019Building Cloud-Native Applications in MiCADO - MiCADO webinar No.2/4 - 09/2019
Building Cloud-Native Applications in MiCADO - MiCADO webinar No.2/4 - 09/2019
 
Bridging the Instance V1 Marks and Encryptions
Bridging the Instance V1 Marks and EncryptionsBridging the Instance V1 Marks and Encryptions
Bridging the Instance V1 Marks and Encryptions
 
From desktop to the cloud with forge
From desktop to the cloud with forgeFrom desktop to the cloud with forge
From desktop to the cloud with forge
 
Cloud Computing-10012021-v4-hosting by Rinko Kabiraj.ppt
Cloud Computing-10012021-v4-hosting by Rinko Kabiraj.pptCloud Computing-10012021-v4-hosting by Rinko Kabiraj.ppt
Cloud Computing-10012021-v4-hosting by Rinko Kabiraj.ppt
 
Forge - DevCon 2016: From Desktop to the Cloud with Forge
Forge - DevCon 2016: From Desktop to the Cloud with ForgeForge - DevCon 2016: From Desktop to the Cloud with Forge
Forge - DevCon 2016: From Desktop to the Cloud with Forge
 
CCCNA17 Introduction
CCCNA17 IntroductionCCCNA17 Introduction
CCCNA17 Introduction
 
Basics of Cloud Computing- 5 th semester
Basics of Cloud Computing- 5 th semesterBasics of Cloud Computing- 5 th semester
Basics of Cloud Computing- 5 th semester
 
Crossover Conveyance V1 Glass Path
Crossover Conveyance V1 Glass PathCrossover Conveyance V1 Glass Path
Crossover Conveyance V1 Glass Path
 
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...TRESOR: The modular cloud - Building a domain specific cloud platform with OS...
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...
 
All Streams Ahead! ksqlDB Workshop ANZ
All Streams Ahead! ksqlDB Workshop ANZAll Streams Ahead! ksqlDB Workshop ANZ
All Streams Ahead! ksqlDB Workshop ANZ
 
AWS Cloud Computing workshop 30-31st May Bangalore
AWS Cloud Computing workshop 30-31st May BangaloreAWS Cloud Computing workshop 30-31st May Bangalore
AWS Cloud Computing workshop 30-31st May Bangalore
 
AWS Cloud Computing workshop 30-31 May Bangalore
AWS Cloud Computing workshop 30-31 May BangaloreAWS Cloud Computing workshop 30-31 May Bangalore
AWS Cloud Computing workshop 30-31 May Bangalore
 
AWS Cloud Computing workshop 30 31st May Bangalore
AWS Cloud Computing workshop 30 31st May BangaloreAWS Cloud Computing workshop 30 31st May Bangalore
AWS Cloud Computing workshop 30 31st May Bangalore
 
AWS Cloud Computing workshop 30-31 May Bangalore
AWS Cloud Computing workshop 30-31 May BangaloreAWS Cloud Computing workshop 30-31 May Bangalore
AWS Cloud Computing workshop 30-31 May Bangalore
 
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...
 
code lab live Google Cloud Endpoints [DevFest 2015 Bari]
code lab live Google Cloud Endpoints [DevFest 2015 Bari]code lab live Google Cloud Endpoints [DevFest 2015 Bari]
code lab live Google Cloud Endpoints [DevFest 2015 Bari]
 
Experiments with Complex Scientific Applications on Hybrid Cloud Infrastructures
Experiments with Complex Scientific Applications on Hybrid Cloud InfrastructuresExperiments with Complex Scientific Applications on Hybrid Cloud Infrastructures
Experiments with Complex Scientific Applications on Hybrid Cloud Infrastructures
 
Cloudstack container service
Cloudstack container serviceCloudstack container service
Cloudstack container service
 
Best
BestBest
Best
 
Lightening the burden of cloud resources administration: from VMs to Functions
Lightening the burden of cloud resources administration: from VMs to FunctionsLightening the burden of cloud resources administration: from VMs to Functions
Lightening the burden of cloud resources administration: from VMs to Functions
 

Kürzlich hochgeladen

Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalFabian de Rijk
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxraffaeleoman
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lodhisaajjda
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatmentnswingard
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIINhPhngng3
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar TrainingKylaCullinane
 
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdfSOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdfMahamudul Hasan
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfSenaatti-kiinteistöt
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Baileyhlharris
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...amilabibi1
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaKayode Fayemi
 
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...David Celestin
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfSkillCertProExams
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoKayode Fayemi
 

Kürzlich hochgeladen (15)

Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of Drupal
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdfSOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
 
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 

AxonIQCon22 - Beyond DDD 101 - Zambrovski-Galinski.pptx

  • 1. Beyond DDD 101 A practice report on building multi bounded context CQRS/ES applications Jan Galinski & Simon Zambrovski Amsterdam, 23.09.2022 1
  • 2. Who we are Jan Galinski Simon Zambrovski 23.09.2022, AxonIQCon 2022 2 Consultants @ holisticon Backend developers, software architects DDD, CQRS/ES, Axon Framework, Spring, Kotlin, Java
  • 3. What is Holisticon • IT Consulting • Hamburg, Hannover, Kiel • Cool crew • Best Employer 2022 in Hamburg • We are hiring! 23.09.2022, AxonIQCon 2022 3 BESTE BERATUNG – BESTE SOFTWARE
  • 4. Motivation • We love architecture • DDD • CQRS • Event Sourcing • Large-scale applications running on JVM • We love Axon Framework • We want to share our experience 23.09.2022, AxonIQCon 2022 4 https://www.pexels.com/de-de/foto/verschiedene-puzzlespiele-1586951/
  • 5. Foundation – Theory - DDD • Set of principles for system implementation • Requirement Engineering • Domain Modeling • Strategic Design • Bounded Context identification • Context Mapping • Design • Ubiquitous Language • Design Patterns 23.09.2022, AxonIQCon 2022 5 https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215
  • 6. Foundation – Theory – DDD Patterns • Modeling of Bounded Context relationships (for Microservices) • Separate Ways • Upstream/Downstream • Open Host Service + Published Language • Anti Corruption Layer • Tactical Design • Value Object, Entity, Aggregate, Aggregate Root • Domain Service, Factory, Repository • Domain Event • Saga Pattern 23.09.2022, AxonIQCon 2022 6
  • 7. Foundation – Theory – CQRS/ES • Command Query Responsibility Segregation Pattern • Reduce complexity of Domain model • Separate Command model from Query model (optimized) • Scale-out independently • Event Sourcing Persistence Strategy • Store Domain Events (versus store State) • Derive State from Domain Event stream • CQRS/ES • Use Domain Events to communicate between Command and Query models • Allow late stream consumption (stream replay) 23.09.2022, AxonIQCon 2022 7
  • 8. Domain Foundation - Onion Architecture Driving (primary) Adapter Driven (secondary) Adapter Domain Model Ring Port Port Application Service Ring Infrastructure Ring 23.09.2022, AxonIQCon 2022 8
  • 9. Axon Framework 101 • FOSS framework in Java for building DDD CQRS(/ES) systems • Explicit message concept • 3 buses for decoupling • Command -> Addressed intent of a change, may fail, unicast • Event -> Fact, broadcast • Query -> Request for data, has result, multicast • Domain Model Segregation (implements CQRS) • Event Sourcing implementation (different Event Stores) • Separation of business logic from configuration 23.09.2022, AxonIQCon 2022 9 https://developer.axoniq.io/download
  • 10. Possible Architecture using Axon Framework 23.09.2022, AxonIQCon 2022 10 https://docs.axoniq.io/reference-guide/
  • 11. System evolution in single context • Build components using buses for communication • Start with modulith • Distribute along buses • Scale out projections • Build new projections later • Change infrastructure 23.09.2022, AxonIQCon 2022 11
  • 12. Domain Core Onion Architecture with Axon Framework REST Adapter Query Model Command Model Command Gateway Query Gateway Projection Repository Aggregate Repository Query Bus Comma nd Bus Event Bus Pivotal Event Bus Pivotal Event Bus Domain Event Bus Domain Comma nd Bus Query Bus Saga 23.09.2022, AxonIQCon 2022 12
  • 13. 23.09.2022, AxonIQCon 2022 13 https://www.pexels.com/de-de/foto/mann-frustration-kopfschmerzen-brille-9843268/
  • 14. Domain Core Onion Architecture with Axon Framework REST Adapter Query Model Command Model Command Gateway Query Gateway Projection Repository Aggregate Repository Query Bus Comma nd Bus Event Bus Pivotal Event Bus Pivotal Event Bus Domain Event Bus Domain Comma nd Bus Query Bus Saga 23.09.2022, AxonIQCon 2022 14
  • 15. Simplified context building block Query Model Command Model Query Bus Comma nd Bus Event Bus Event Bus Comma nd Bus Query Bus Saga 23.09.2022, AxonIQCon 2022 15
  • 17. Q Master Data Query Q S D U 23.09.2022, AxonIQCon 2022 17 „You know some things that I need to know, please tell me!“ Query
  • 18. Master Data Query Q S Q D U 23.09.2022, AxonIQCon 2022 18 Query Benefits • Simple (~ GET) • No redundancy (GDPR) • Encapsulate complex business logic Challenges • Runtime dependency • Trap: Building specialized projections for other teams • Outdated data, caching
  • 19. Trigger a query C U D 23.09.2022, AxonIQCon 2022 19 Q Q „I made some changes … ask me if you want more details.“ Query C‘
  • 20. Trigger a query C U D 23.09.2022, AxonIQCon 2022 20 Q Q Query Benefits •„Cache invalidation“ Challenges •Runtime dependency* •Load (query avalanche)
  • 21. Query Aggregator C Q U D 23.09.2022, AxonIQCon 2022 21 „Here is some data that could be useful to build your projection.“ Query Q‘ C‘
  • 22. Query Aggregator C Q U D 23.09.2022, AxonIQCon 2022 22 Query Benefits • Decoupling • Build complex projections from other contexts Challenges • Event Payload definition • Payload interpretation
  • 23. Reacting to Fact C S C U D 23.09.2022, AxonIQCon 2022 23 Command „I changed some things … deal with it.“ C‘ C‘
  • 24. Reacting to Fact C S C U D 23.09.2022, AxonIQCon 2022 24 Command Benefits • Simple • Decoupled • Event Driven Challenges • Downstream Command model must follow • Command-Event-Command bridge
  • 25. Downstream Saga C S C D U 23.09.2022, AxonIQCon 2022 25 Command „I need you to do something for me, and I need the result.“ C* C‘ C‘
  • 26. Downstream Saga C S C D U 23.09.2022, AxonIQCon 2022 26 Command Benefits • Build for failure • Delegate sub processes Challenges • Compensation • Complex for more than one context
  • 27. External Orchestrator C S C D U U 23.09.2022, AxonIQCon 2022 27 Command C* C* C‘ C‘ „If you two cannot handle it, let me take control.“
  • 28. External Orchestrator C S C D U U 23.09.2022, AxonIQCon 2022 28 Command Benefits • Build for failure • Separate ways • Business process Challenges • Compensation • Complex for more than one context
  • 29. Key Takeaways • Domain Driven Design • Start with Strategic Design • Do proper Context Mapping – Relationships! • CQRS/ES • Use Command / Event / Query abstractions („Events only“ is not enough) • Use Axon Framework if working on JVM • Practical • Start with a modulith • Build evolutionary • Distribute on demand 23.09.2022, AxonIQCon 2022 29
  • 30. Thank you... Questions? • Holisticon AG • https://holisticon.de/ • Jan • https://about.me/jangalinski • Simon • https://about.me/zambrovski • Axon Framework • https://developer.axoniq.io/ 23.09.2022, AxonIQCon 2022 30 https://www.pexels.com/de-de/foto/fragezeichen-auf-zerknittertem-papier-5428826/

Hinweis der Redaktion

  1. Camunda Champions/Process Automation
  2. Context defines semantics ACL - semantical mapping Design:
  3. Command Model: validation Query Model: optimized projections
  4. ES: EventStore(s), Replay, Snapshotting, Upcasting
  5. This was a lot to swallow – DD/CQR/Oninon in 10 Minutes Reached the Plateau of maximum complexity Story of ranked Break down
  6. we only care about the external/pivotal view
  7. 2 models, a saga, 3 busses
  8. Separate ways is already a pattern not invented but recognized/discovered Introduce a model for context communication how they commincate: patterns – no true or false, combinations are possible We have 6 today, but there might be more Query Patterns Command Patterns
  9. Reporting collects customer data and account to send out letters credit manager needs balance history to calculate interest rates ...
  10. Hint: GraphQL Remote projection
  11. Event: Milestone/Trigger/Notification Runtime: not that hard Query might not return the result the event intended
  12. Event: Fat Event, contains data
  13. Do we event source fat pivotal events? next: command
  14. ACL Pure Choreography
  15. customer wants to cancel releationship account management discovers open debt and rejects if sync: command failing might be enough if async: ack/nack event
  16. pure orchestration
  17. Separate ways Complex business scenarios Process engine