SlideShare une entreprise Scribd logo
1  sur  40
Télécharger pour lire hors ligne
1
CQRS & EVENT
SOURCING
With Lagom
2 . 1
Miel Donkers
@mieldonkers
github.com/mdonkers
 
@codecentric_nl
2 . 2
Agenda
CQRS concepts
Event Sourcing concepts
Introduction Lagom framework
CQRS & ES as basis for Lagom
Lagom code / demo
3 . 1
What is CQRS
3 . 2
What is CQRS
Command Query Responsibility Segregation
3 . 3
Traditional Architecture
© Martin Fowler
3 . 4
CQRS Architecture
© Martin Fowler
3 . 5
Storing data
Simple approach
Single database
Normalized tables for write-side data
Views for denormalizing data
Keep queries simple
3 . 6
CQRS related to DDD
DDD - Domain Driven Design
Bounded Context
Aggregate
Command
Event
3 . 7
DDD example
3 . 8
Command - Event - State
3 . 9
Service owns data
4 . 1
What is ES
4 . 2
What is ES
Event Sourcing
Event describes the state change of aggregate
Event is saved in event store
Events can be replayed to re-create the current state.
4 . 3
CQRS & ES Combined
4 . 4
Architecture with Transactions
© Microsoft - CQRS Journey
4 . 5
Architecture with Messages
© Microsoft - CQRS Journey
4 . 6
The hard parts
4 . 7
Consistency
Key feature for the Event Store
Without transactions, much work needed to make as
reliable
Versioning / timestamps
Eventual consistency
4 . 8
Error Handling
Distinguish between business faults and errors.
Errors can be re-tried.
Business faults should have pre-determined
reaction.
4 . 9
Other disadvantages
Many moving parts, makes it hard to debug the
system as a whole
CQRS not for every bounded context
4 . 10
Advantages
4 . 11
Advantages
Auditing and historical tracing
Read and write side can be optimized separately
Debug in local environment
Small components which are easy to update / fix
No ORM impedance mismatch
5 . 1
Lagom microservice framework
5 . 2
Design philosophy
Distributed
Asynchronous
Productivity
5 . 3
Concepts
Microservices
Polyglot
Design Driven APIs
Immutability
Event Sourcing and CQRS
5 . 4
Opiniated
ServiceCall<Source<String, NotUsed>, Source<String, NotUsed>> stream();
@Override
default Descriptor descriptor() {
return named("stream").withCalls(namedCall("stream", this::stream))
.withAutoAcl(true);
}
5 . 5
Core technologies
Akka
Akka Streams
Akka Persistence
Akka Cluster
Play
ConductR
5 . 6
Lagom persistence
Cassandra
PersistentEntity
Requires Command, Eventand State
Single instance kept in memory
5 . 7
Command - Event - State
5 . 8
5 . 9
Get me all inspections with remarks for a given ship
Query example
5 . 10
Lagom JDBC support
Available in 1.2 release
Slick
Storing and reading entities
6 . 1
CODE
6 . 27 . 1
Wrapping Up
7 . 2
Lessons learned
Conventions make setup easy
Framework on top of many layers
...
[INFO] Service locator is running at http://localhost:8000
[INFO] Service gateway is running at http://localhost:9000
...
[INFO] (Service started, press enter to stop and go back to the console...)
[error] c.l.l.i.s.ServiceRegistrationModule$RegisterWithServiceRegistry
- Service name=[hello] couldn't register itself to the service locator.
com.lightbend.lagom.javadsl.api.transport.TransportException: <head>
...
[error] a.c.s.PersistentShardCoordinator - Persistence failure when replaying
events for persistenceId [/sharding/HelloEntityCoordinator]. Last
known sequence number [0]
com.lightbend.lagom.javadsl.api.transport.PolicyViolation: <head>
...
7 . 3
7 . 4
Links
Martin Fowler - CQRS
Microsoft - CQRS Journey
Lagom Framework
Miel Donkers - Lagom CQRS Demo
7 . 5
Thank You!
7 . 6
We're hiring

Contenu connexe

Tendances

Lagom : Reactive microservice framework
Lagom : Reactive microservice frameworkLagom : Reactive microservice framework
Lagom : Reactive microservice frameworkFabrice Sznajderman
 
Application Deployment and Management at Scale at 1&1
Application Deployment and Management at Scale at 1&1Application Deployment and Management at Scale at 1&1
Application Deployment and Management at Scale at 1&1Matt Baldwin
 
Stay productive while slicing up the monolith
Stay productive while slicing up the monolith Stay productive while slicing up the monolith
Stay productive while slicing up the monolith Markus Eisele
 
Oops! I started a broker | Yinon Kahta, Taboola
Oops! I started a broker | Yinon Kahta, TaboolaOops! I started a broker | Yinon Kahta, Taboola
Oops! I started a broker | Yinon Kahta, TaboolaHostedbyConfluent
 
Dennis Doomen. Using OWIN, Webhooks, Event Sourcing and the Onion Architectur...
Dennis Doomen. Using OWIN, Webhooks, Event Sourcing and the Onion Architectur...Dennis Doomen. Using OWIN, Webhooks, Event Sourcing and the Onion Architectur...
Dennis Doomen. Using OWIN, Webhooks, Event Sourcing and the Onion Architectur...IT Arena
 
Building Cloud Native Applications Using Spring Boot and Spring Cloud
Building Cloud Native Applications Using Spring Boot and Spring CloudBuilding Cloud Native Applications Using Spring Boot and Spring Cloud
Building Cloud Native Applications Using Spring Boot and Spring CloudGeekNightHyderabad
 
How Apache Kafka® Works
How Apache Kafka® WorksHow Apache Kafka® Works
How Apache Kafka® Worksconfluent
 
Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...
Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...
Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...Docker, Inc.
 
Dnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDotNetCampus
 
Levelling up in Akka
Levelling up in AkkaLevelling up in Akka
Levelling up in AkkaSigmoid
 
Lightbend Training for Scala, Akka, Play Framework and Apache Spark
Lightbend Training for Scala, Akka, Play Framework and Apache SparkLightbend Training for Scala, Akka, Play Framework and Apache Spark
Lightbend Training for Scala, Akka, Play Framework and Apache SparkLightbend
 
How ddd, cqrs and event sourcing constitute the architecture of the future
How ddd, cqrs and event sourcing constitute the architecture of the futureHow ddd, cqrs and event sourcing constitute the architecture of the future
How ddd, cqrs and event sourcing constitute the architecture of the futureMSDEVMTL
 
Kubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platformKubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platformLivePerson
 

Tendances (19)

Lagom : Reactive microservice framework
Lagom : Reactive microservice frameworkLagom : Reactive microservice framework
Lagom : Reactive microservice framework
 
JEEconf 2017
JEEconf 2017JEEconf 2017
JEEconf 2017
 
Application Deployment and Management at Scale at 1&1
Application Deployment and Management at Scale at 1&1Application Deployment and Management at Scale at 1&1
Application Deployment and Management at Scale at 1&1
 
Stay productive while slicing up the monolith
Stay productive while slicing up the monolith Stay productive while slicing up the monolith
Stay productive while slicing up the monolith
 
Container Patterns
Container PatternsContainer Patterns
Container Patterns
 
Oops! I started a broker | Yinon Kahta, Taboola
Oops! I started a broker | Yinon Kahta, TaboolaOops! I started a broker | Yinon Kahta, Taboola
Oops! I started a broker | Yinon Kahta, Taboola
 
Dennis Doomen. Using OWIN, Webhooks, Event Sourcing and the Onion Architectur...
Dennis Doomen. Using OWIN, Webhooks, Event Sourcing and the Onion Architectur...Dennis Doomen. Using OWIN, Webhooks, Event Sourcing and the Onion Architectur...
Dennis Doomen. Using OWIN, Webhooks, Event Sourcing and the Onion Architectur...
 
Building Cloud Native Applications Using Spring Boot and Spring Cloud
Building Cloud Native Applications Using Spring Boot and Spring CloudBuilding Cloud Native Applications Using Spring Boot and Spring Cloud
Building Cloud Native Applications Using Spring Boot and Spring Cloud
 
How Apache Kafka® Works
How Apache Kafka® WorksHow Apache Kafka® Works
How Apache Kafka® Works
 
Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...
Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...
Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...
 
Dnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforusso
 
Levelling up in Akka
Levelling up in AkkaLevelling up in Akka
Levelling up in Akka
 
Microservices: Another Way
Microservices: Another WayMicroservices: Another Way
Microservices: Another Way
 
Lightbend Training for Scala, Akka, Play Framework and Apache Spark
Lightbend Training for Scala, Akka, Play Framework and Apache SparkLightbend Training for Scala, Akka, Play Framework and Apache Spark
Lightbend Training for Scala, Akka, Play Framework and Apache Spark
 
How ddd, cqrs and event sourcing constitute the architecture of the future
How ddd, cqrs and event sourcing constitute the architecture of the futureHow ddd, cqrs and event sourcing constitute the architecture of the future
How ddd, cqrs and event sourcing constitute the architecture of the future
 
AKS
AKSAKS
AKS
 
Reactive Architectures
Reactive ArchitecturesReactive Architectures
Reactive Architectures
 
Through the JMX Window
Through the JMX WindowThrough the JMX Window
Through the JMX Window
 
Kubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platformKubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platform
 

Similaire à CQRS and ES with Lagom

Scale and Throughput @ Clicktale with Akka
Scale and Throughput @ Clicktale with AkkaScale and Throughput @ Clicktale with Akka
Scale and Throughput @ Clicktale with AkkaYuval Itzchakov
 
Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph
Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph
Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph Ceph Community
 
DevOps Course Contents.docx
DevOps Course Contents.docxDevOps Course Contents.docx
DevOps Course Contents.docxFuturepoint13
 
Give Your Confluent Platform Superpowers! (Sandeep Togrika, Intel and Bert Ha...
Give Your Confluent Platform Superpowers! (Sandeep Togrika, Intel and Bert Ha...Give Your Confluent Platform Superpowers! (Sandeep Togrika, Intel and Bert Ha...
Give Your Confluent Platform Superpowers! (Sandeep Togrika, Intel and Bert Ha...HostedbyConfluent
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixBrendan Gregg
 
Oow2007 performance
Oow2007 performanceOow2007 performance
Oow2007 performanceRicky Zhu
 
G rpc talk with intel (3)
G rpc talk with intel (3)G rpc talk with intel (3)
G rpc talk with intel (3)Intel
 
download it from here
download it from heredownload it from here
download it from herewebhostingguy
 
Implementing Domain Events with Kafka
Implementing Domain Events with KafkaImplementing Domain Events with Kafka
Implementing Domain Events with KafkaAndrei Rugina
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEQAware GmbH
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEMario-Leander Reimer
 
Big datadc skyfall_preso_v2
Big datadc skyfall_preso_v2Big datadc skyfall_preso_v2
Big datadc skyfall_preso_v2abramsm
 
OOW09 EBS Tech Essentials
OOW09 EBS Tech EssentialsOOW09 EBS Tech Essentials
OOW09 EBS Tech Essentialsjucaab
 
Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...IndicThreads
 
Azure SQL Managed Instance - SqlBits 2019
Azure SQL Managed Instance - SqlBits 2019Azure SQL Managed Instance - SqlBits 2019
Azure SQL Managed Instance - SqlBits 2019Jovan Popovic
 
Oracle 10g rac_overview
Oracle 10g rac_overviewOracle 10g rac_overview
Oracle 10g rac_overviewRobel Parvini
 
Learning spark ch10 - Spark Streaming
Learning spark ch10 - Spark StreamingLearning spark ch10 - Spark Streaming
Learning spark ch10 - Spark Streamingphanleson
 
GWAB 2015 - Data Plaraform
GWAB 2015 - Data PlaraformGWAB 2015 - Data Plaraform
GWAB 2015 - Data PlaraformMarcelo Paiva
 

Similaire à CQRS and ES with Lagom (20)

Scale and Throughput @ Clicktale with Akka
Scale and Throughput @ Clicktale with AkkaScale and Throughput @ Clicktale with Akka
Scale and Throughput @ Clicktale with Akka
 
Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph
Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph
Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph
 
DevOps Course Contents.docx
DevOps Course Contents.docxDevOps Course Contents.docx
DevOps Course Contents.docx
 
Give Your Confluent Platform Superpowers! (Sandeep Togrika, Intel and Bert Ha...
Give Your Confluent Platform Superpowers! (Sandeep Togrika, Intel and Bert Ha...Give Your Confluent Platform Superpowers! (Sandeep Togrika, Intel and Bert Ha...
Give Your Confluent Platform Superpowers! (Sandeep Togrika, Intel and Bert Ha...
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at Netflix
 
Oow2007 performance
Oow2007 performanceOow2007 performance
Oow2007 performance
 
G rpc talk with intel (3)
G rpc talk with intel (3)G rpc talk with intel (3)
G rpc talk with intel (3)
 
download it from here
download it from heredownload it from here
download it from here
 
Implementing Domain Events with Kafka
Implementing Domain Events with KafkaImplementing Domain Events with Kafka
Implementing Domain Events with Kafka
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EE
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EE
 
Big datadc skyfall_preso_v2
Big datadc skyfall_preso_v2Big datadc skyfall_preso_v2
Big datadc skyfall_preso_v2
 
OOW09 EBS Tech Essentials
OOW09 EBS Tech EssentialsOOW09 EBS Tech Essentials
OOW09 EBS Tech Essentials
 
Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...
 
Azure SQL Managed Instance - SqlBits 2019
Azure SQL Managed Instance - SqlBits 2019Azure SQL Managed Instance - SqlBits 2019
Azure SQL Managed Instance - SqlBits 2019
 
Oracle 10g rac_overview
Oracle 10g rac_overviewOracle 10g rac_overview
Oracle 10g rac_overview
 
Azure and cloud design patterns
Azure and cloud design patternsAzure and cloud design patterns
Azure and cloud design patterns
 
Learning spark ch10 - Spark Streaming
Learning spark ch10 - Spark StreamingLearning spark ch10 - Spark Streaming
Learning spark ch10 - Spark Streaming
 
ES and CQRS workshop
ES and CQRS workshopES and CQRS workshop
ES and CQRS workshop
 
GWAB 2015 - Data Plaraform
GWAB 2015 - Data PlaraformGWAB 2015 - Data Plaraform
GWAB 2015 - Data Plaraform
 

Plus de Miel Donkers

Instana - ClickHouse presentation
Instana - ClickHouse presentationInstana - ClickHouse presentation
Instana - ClickHouse presentationMiel Donkers
 
CQRS and Event Sourcing with Akka, Cassandra and RabbitMQ
CQRS and Event Sourcing with Akka, Cassandra and RabbitMQCQRS and Event Sourcing with Akka, Cassandra and RabbitMQ
CQRS and Event Sourcing with Akka, Cassandra and RabbitMQMiel Donkers
 
Code reviews and pair programming
Code reviews and pair programmingCode reviews and pair programming
Code reviews and pair programmingMiel Donkers
 
Continuous delivery is not finished
Continuous delivery is not finishedContinuous delivery is not finished
Continuous delivery is not finishedMiel Donkers
 
DevOps presentation at gemeente Rotterdam
DevOps presentation at gemeente RotterdamDevOps presentation at gemeente Rotterdam
DevOps presentation at gemeente RotterdamMiel Donkers
 
Successful testing continuous delivery - coding serbia 2013
Successful testing continuous delivery - coding serbia 2013Successful testing continuous delivery - coding serbia 2013
Successful testing continuous delivery - coding serbia 2013Miel Donkers
 
Testing the continuous delivery process @dev opsdays ams 2013
Testing the continuous delivery process   @dev opsdays ams 2013Testing the continuous delivery process   @dev opsdays ams 2013
Testing the continuous delivery process @dev opsdays ams 2013Miel Donkers
 

Plus de Miel Donkers (7)

Instana - ClickHouse presentation
Instana - ClickHouse presentationInstana - ClickHouse presentation
Instana - ClickHouse presentation
 
CQRS and Event Sourcing with Akka, Cassandra and RabbitMQ
CQRS and Event Sourcing with Akka, Cassandra and RabbitMQCQRS and Event Sourcing with Akka, Cassandra and RabbitMQ
CQRS and Event Sourcing with Akka, Cassandra and RabbitMQ
 
Code reviews and pair programming
Code reviews and pair programmingCode reviews and pair programming
Code reviews and pair programming
 
Continuous delivery is not finished
Continuous delivery is not finishedContinuous delivery is not finished
Continuous delivery is not finished
 
DevOps presentation at gemeente Rotterdam
DevOps presentation at gemeente RotterdamDevOps presentation at gemeente Rotterdam
DevOps presentation at gemeente Rotterdam
 
Successful testing continuous delivery - coding serbia 2013
Successful testing continuous delivery - coding serbia 2013Successful testing continuous delivery - coding serbia 2013
Successful testing continuous delivery - coding serbia 2013
 
Testing the continuous delivery process @dev opsdays ams 2013
Testing the continuous delivery process   @dev opsdays ams 2013Testing the continuous delivery process   @dev opsdays ams 2013
Testing the continuous delivery process @dev opsdays ams 2013
 

Dernier

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Dernier (20)

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

CQRS and ES with Lagom

  • 2. 2 . 1 Miel Donkers @mieldonkers github.com/mdonkers   @codecentric_nl
  • 3. 2 . 2 Agenda CQRS concepts Event Sourcing concepts Introduction Lagom framework CQRS & ES as basis for Lagom Lagom code / demo
  • 4. 3 . 1 What is CQRS
  • 5. 3 . 2 What is CQRS Command Query Responsibility Segregation
  • 6. 3 . 3 Traditional Architecture © Martin Fowler
  • 7. 3 . 4 CQRS Architecture © Martin Fowler
  • 8. 3 . 5 Storing data Simple approach Single database Normalized tables for write-side data Views for denormalizing data Keep queries simple
  • 9. 3 . 6 CQRS related to DDD DDD - Domain Driven Design Bounded Context Aggregate Command Event
  • 10. 3 . 7 DDD example
  • 11. 3 . 8 Command - Event - State
  • 12. 3 . 9 Service owns data
  • 13. 4 . 1 What is ES
  • 14. 4 . 2 What is ES Event Sourcing Event describes the state change of aggregate Event is saved in event store Events can be replayed to re-create the current state.
  • 15. 4 . 3 CQRS & ES Combined
  • 16. 4 . 4 Architecture with Transactions © Microsoft - CQRS Journey
  • 17. 4 . 5 Architecture with Messages © Microsoft - CQRS Journey
  • 18. 4 . 6 The hard parts
  • 19. 4 . 7 Consistency Key feature for the Event Store Without transactions, much work needed to make as reliable Versioning / timestamps Eventual consistency
  • 20. 4 . 8 Error Handling Distinguish between business faults and errors. Errors can be re-tried. Business faults should have pre-determined reaction.
  • 21. 4 . 9 Other disadvantages Many moving parts, makes it hard to debug the system as a whole CQRS not for every bounded context
  • 23. 4 . 11 Advantages Auditing and historical tracing Read and write side can be optimized separately Debug in local environment Small components which are easy to update / fix No ORM impedance mismatch
  • 24. 5 . 1 Lagom microservice framework
  • 25. 5 . 2 Design philosophy Distributed Asynchronous Productivity
  • 26. 5 . 3 Concepts Microservices Polyglot Design Driven APIs Immutability Event Sourcing and CQRS
  • 27. 5 . 4 Opiniated ServiceCall<Source<String, NotUsed>, Source<String, NotUsed>> stream(); @Override default Descriptor descriptor() { return named("stream").withCalls(namedCall("stream", this::stream)) .withAutoAcl(true); }
  • 28. 5 . 5 Core technologies Akka Akka Streams Akka Persistence Akka Cluster Play ConductR
  • 29. 5 . 6 Lagom persistence Cassandra PersistentEntity Requires Command, Eventand State Single instance kept in memory
  • 30. 5 . 7 Command - Event - State
  • 31.
  • 32. 5 . 8 5 . 9 Get me all inspections with remarks for a given ship Query example
  • 33. 5 . 10 Lagom JDBC support Available in 1.2 release Slick Storing and reading entities
  • 35. 6 . 27 . 1 Wrapping Up
  • 36. 7 . 2 Lessons learned Conventions make setup easy Framework on top of many layers
  • 37. ... [INFO] Service locator is running at http://localhost:8000 [INFO] Service gateway is running at http://localhost:9000 ... [INFO] (Service started, press enter to stop and go back to the console...) [error] c.l.l.i.s.ServiceRegistrationModule$RegisterWithServiceRegistry - Service name=[hello] couldn't register itself to the service locator. com.lightbend.lagom.javadsl.api.transport.TransportException: <head> ... [error] a.c.s.PersistentShardCoordinator - Persistence failure when replaying events for persistenceId [/sharding/HelloEntityCoordinator]. Last known sequence number [0] com.lightbend.lagom.javadsl.api.transport.PolicyViolation: <head> ...
  • 38. 7 . 3 7 . 4 Links Martin Fowler - CQRS Microsoft - CQRS Journey Lagom Framework Miel Donkers - Lagom CQRS Demo
  • 39. 7 . 5 Thank You!
  • 40. 7 . 6 We're hiring