SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
1
CQRS & ES
With Akka, Cassandra and
RabbitMQ
Miel Donkers, codecentric
2 . 1
Why??
2 . 2
What is CQRS
2 . 3
What is CQRS
Command Query Responsibility Segregation
2 . 4
Traditional Architecture
© Martin Fowler
2 . 5
CQRS Architecture
© Martin Fowler
2 . 6
Storing data
Simple approach
Single database
Normalized tables for write-side data
Views for denormalizing data
Keep queries simple
2 . 7
CQRS related to DDD
DDD - Domain Driven Design
Bounded Context
Aggregate
Command
Event
2 . 8
What is ES
2 . 9
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.
2 . 10
CQRS & ES Combined
2 . 11
Architecture with Transactions
© Microsoft - CQRS Journey
2 . 12
Architecture with Events
© Microsoft - CQRS Journey
2 . 13
Architecture with Messages
© Microsoft - CQRS Journey
2 . 14
The hard parts
2 . 15
Consistency
Key feature for the Event Store
Without transactions, much work needed to make as
reliable
Versioning / timestamps
Eventual consistency
2 . 16
Error Handling
Distinguish between business faults and errors.
Errors can be re-tried.
Business faults should have pre-determined
reaction.
2 . 17
Other disadvantages
Many moving parts, makes it hard to debug the
system as a whole
CQRS not for every bounded context
2 . 18
Advantages
2 . 19
Advantages
Task-based UI
Read and write side can be optimized separately
Debug in local environment
Small components which are easy to update / ïŹx
2 . 20
Code
2 . 21
User Aggregate
Not Finished
2 . 22
User Repository
private var users = Set.empty[User]
override def receiveCommand: Receive = {
case GetUsers =>
sender() ! users
case AddUser(name) if users.exists(_.name == name) =>
sender() ! UserExists(name)
case AddUser(user) =>
persist(user) { persistedUser =>
receiveRecover(persistedUser)
sender() ! UserAdded(persistedUser)
}
}
override def receiveRecover: Receive = {
case user: User => users += user
}
2 . 23
Event Sender
private var unconfirmed = immutable.SortedMap.empty[Long, ActorPath]
override def receive: Receive = {
case Msg(deliveryId, user) =>
unconfirmed = unconfirmed.updated(deliveryId, sender().path)
val headersMap = Map(RabbitMQConstants.MESSAGE_ID -> deliveryId, RabbitMQ
camelSender ! CamelMessage(user.asJson.noSpaces, headersMap)
case CamelMessage(_, headers) =>
val deliveryId: Long = headers.getOrElse(RabbitMQConstants.MESSAGE_ID, -
unconfirmed.get(deliveryId).foreach(
senderActor => {
unconfirmed -= deliveryId
context.actorSelection(senderActor) ! Confirm(deliveryId)
})
case Status.Failure(ex) =>
2 . 24
Event Receiver
override def receive: Receive = {
case msg: CamelMessage =>
val body: Xor[Error, User] = decode[User](msg.bodyAs[String])
body.fold({ error =>
sender() ! Failure(error)
}, { user =>
sender() ! Ack
})
case _ => log.warning("Unexpected event received")
}
2 . 25
Links
Martin Fowler - CQRS
Microsoft - CQRS Journey
Akka
Heiko Seeberger - Reactive Flows Demo
3 . 1
Wrapping Up
3 . 2
Feedback
3 . 3
The End
 
Copyright 2016

Weitere Àhnliche Inhalte

Was ist angesagt?

MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB
 
Hadoop trong triển khai Big Data
Hadoop trong triển khai Big DataHadoop trong triển khai Big Data
Hadoop trong triển khai Big DataNguyễn Duy NhĂąn
 
Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!PGConf APAC
 
18 Months of Event Sourcing and CQRS Using Microsoft Orleans
18 Months of Event Sourcing and CQRS Using Microsoft Orleans18 Months of Event Sourcing and CQRS Using Microsoft Orleans
18 Months of Event Sourcing and CQRS Using Microsoft OrleansAndy Hoyle
 
Đề tĂ i: Ớng dỄng kho dữ liệu để tĂ­ch hợp dữ liệu hệ thống, HOT
Đề tĂ i: Ớng dỄng kho dữ liệu để tĂ­ch hợp dữ liệu hệ thống, HOTĐề tĂ i: Ớng dỄng kho dữ liệu để tĂ­ch hợp dữ liệu hệ thống, HOT
Đề tĂ i: Ớng dỄng kho dữ liệu để tĂ­ch hợp dữ liệu hệ thống, HOTDịch vỄ viáșżt bĂ i trọn gĂłi ZALO 0917193864
 
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...Databricks
 
TPC-H Column Store and MPP systems
TPC-H Column Store and MPP systemsTPC-H Column Store and MPP systems
TPC-H Column Store and MPP systemsMostafa Mokhtar
 
Database migration from Sybase ASE to PostgreSQL @2013.pgconf.eu
Database migration from Sybase ASE to PostgreSQL @2013.pgconf.euDatabase migration from Sybase ASE to PostgreSQL @2013.pgconf.eu
Database migration from Sybase ASE to PostgreSQL @2013.pgconf.eualdaschwede80
 
Microservices Interview Questions and Answers | Microservices Architecture Tr...
Microservices Interview Questions and Answers | Microservices Architecture Tr...Microservices Interview Questions and Answers | Microservices Architecture Tr...
Microservices Interview Questions and Answers | Microservices Architecture Tr...Edureka!
 
Exactly-once Stream Processing with Kafka Streams
Exactly-once Stream Processing with Kafka StreamsExactly-once Stream Processing with Kafka Streams
Exactly-once Stream Processing with Kafka StreamsGuozhang Wang
 
Introducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineIntroducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineVMware Tanzu
 
CQRS and Event Sourcing in a Symfony application
CQRS and Event Sourcing in a Symfony applicationCQRS and Event Sourcing in a Symfony application
CQRS and Event Sourcing in a Symfony applicationSamuel ROZE
 
Amazon EMR Deep Dive & Best Practices
Amazon EMR Deep Dive & Best PracticesAmazon EMR Deep Dive & Best Practices
Amazon EMR Deep Dive & Best PracticesAmazon Web Services
 
Spark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka StreamsSpark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka StreamsGuido Schmutz
 
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...Lucas Jellema
 
A visual introduction to Event Sourcing and CQRS
A visual introduction to Event Sourcing and CQRSA visual introduction to Event Sourcing and CQRS
A visual introduction to Event Sourcing and CQRSLorenzo Nicora
 
[Apache KafkaÂź Meetup by Confluent] Graph-based stream processing
[Apache KafkaÂź Meetup by Confluent] Graph-based stream processing[Apache KafkaÂź Meetup by Confluent] Graph-based stream processing
[Apache KafkaÂź Meetup by Confluent] Graph-based stream processingconfluent
 
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Guido Schmutz
 

Was ist angesagt? (20)

Luáș­n văn: PhÆ°ÆĄng phĂĄp táș„n cĂŽng chữ kĂœ số: Rsa,Elgamal,Dss
Luáș­n văn: PhÆ°ÆĄng phĂĄp táș„n cĂŽng chữ kĂœ số: Rsa,Elgamal,DssLuáș­n văn: PhÆ°ÆĄng phĂĄp táș„n cĂŽng chữ kĂœ số: Rsa,Elgamal,Dss
Luáș­n văn: PhÆ°ÆĄng phĂĄp táș„n cĂŽng chữ kĂœ số: Rsa,Elgamal,Dss
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
Hadoop trong triển khai Big Data
Hadoop trong triển khai Big DataHadoop trong triển khai Big Data
Hadoop trong triển khai Big Data
 
Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!
 
18 Months of Event Sourcing and CQRS Using Microsoft Orleans
18 Months of Event Sourcing and CQRS Using Microsoft Orleans18 Months of Event Sourcing and CQRS Using Microsoft Orleans
18 Months of Event Sourcing and CQRS Using Microsoft Orleans
 
Đề tĂ i: Ớng dỄng kho dữ liệu để tĂ­ch hợp dữ liệu hệ thống, HOT
Đề tĂ i: Ớng dỄng kho dữ liệu để tĂ­ch hợp dữ liệu hệ thống, HOTĐề tĂ i: Ớng dỄng kho dữ liệu để tĂ­ch hợp dữ liệu hệ thống, HOT
Đề tĂ i: Ớng dỄng kho dữ liệu để tĂ­ch hợp dữ liệu hệ thống, HOT
 
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...
 
TPC-H Column Store and MPP systems
TPC-H Column Store and MPP systemsTPC-H Column Store and MPP systems
TPC-H Column Store and MPP systems
 
Database migration from Sybase ASE to PostgreSQL @2013.pgconf.eu
Database migration from Sybase ASE to PostgreSQL @2013.pgconf.euDatabase migration from Sybase ASE to PostgreSQL @2013.pgconf.eu
Database migration from Sybase ASE to PostgreSQL @2013.pgconf.eu
 
Microservices Interview Questions and Answers | Microservices Architecture Tr...
Microservices Interview Questions and Answers | Microservices Architecture Tr...Microservices Interview Questions and Answers | Microservices Architecture Tr...
Microservices Interview Questions and Answers | Microservices Architecture Tr...
 
Exactly-once Stream Processing with Kafka Streams
Exactly-once Stream Processing with Kafka StreamsExactly-once Stream Processing with Kafka Streams
Exactly-once Stream Processing with Kafka Streams
 
Introducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineIntroducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring Statemachine
 
CQRS and Event Sourcing in a Symfony application
CQRS and Event Sourcing in a Symfony applicationCQRS and Event Sourcing in a Symfony application
CQRS and Event Sourcing in a Symfony application
 
Amazon EMR Deep Dive & Best Practices
Amazon EMR Deep Dive & Best PracticesAmazon EMR Deep Dive & Best Practices
Amazon EMR Deep Dive & Best Practices
 
Spark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka StreamsSpark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka Streams
 
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
 
A visual introduction to Event Sourcing and CQRS
A visual introduction to Event Sourcing and CQRSA visual introduction to Event Sourcing and CQRS
A visual introduction to Event Sourcing and CQRS
 
Grafana 7.0
Grafana 7.0Grafana 7.0
Grafana 7.0
 
[Apache KafkaÂź Meetup by Confluent] Graph-based stream processing
[Apache KafkaÂź Meetup by Confluent] Graph-based stream processing[Apache KafkaÂź Meetup by Confluent] Graph-based stream processing
[Apache KafkaÂź Meetup by Confluent] Graph-based stream processing
 
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
 

Andere mochten auch

CQRS and Event Sourcing, An Alternative Architecture for DDD
CQRS and Event Sourcing, An Alternative Architecture for DDDCQRS and Event Sourcing, An Alternative Architecture for DDD
CQRS and Event Sourcing, An Alternative Architecture for DDDDennis Doomen
 
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
 
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
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersMarkus Eisele
 
A year with event sourcing and CQRS
A year with event sourcing and CQRSA year with event sourcing and CQRS
A year with event sourcing and CQRSSteve Pember
 
codecentric AG: CQRS and Event Sourcing Applications with Cassandra
codecentric AG: CQRS and Event Sourcing Applications with Cassandracodecentric AG: CQRS and Event Sourcing Applications with Cassandra
codecentric AG: CQRS and Event Sourcing Applications with CassandraDataStax Academy
 

Andere mochten auch (6)

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
 
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
 
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...
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java Developers
 
A year with event sourcing and CQRS
A year with event sourcing and CQRSA year with event sourcing and CQRS
A year with event sourcing and CQRS
 
codecentric AG: CQRS and Event Sourcing Applications with Cassandra
codecentric AG: CQRS and Event Sourcing Applications with Cassandracodecentric AG: CQRS and Event Sourcing Applications with Cassandra
codecentric AG: CQRS and Event Sourcing Applications with Cassandra
 

Ähnlich wie CQRS and Event Sourcing with Akka, Cassandra and RabbitMQ

Copenhagen ruby brigade november 2018
Copenhagen ruby brigade   november 2018Copenhagen ruby brigade   november 2018
Copenhagen ruby brigade november 2018Anders Lemke
 
GraniteDS 360|Flex DC
GraniteDS 360|Flex DCGraniteDS 360|Flex DC
GraniteDS 360|Flex DCwdrai
 
MS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applicationsMS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applicationsSpiffy
 
Cqrs and event sourcing in azure
Cqrs and event sourcing in azureCqrs and event sourcing in azure
Cqrs and event sourcing in azureSergey Seletsky
 
Ch01 Introduction to Exchange 2013
Ch01 Introduction to Exchange 2013Ch01 Introduction to Exchange 2013
Ch01 Introduction to Exchange 2013Shane Flooks
 
Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new featuresAlfredo Krieg
 
MSP-AzureDev101
MSP-AzureDev101MSP-AzureDev101
MSP-AzureDev101Dominic Green
 
Sprint 207
Sprint 207Sprint 207
Sprint 207ManageIQ
 
Greenfield Development with CQRS
Greenfield Development with CQRSGreenfield Development with CQRS
Greenfield Development with CQRSDavid Hoerster
 
Moving to ws2003
Moving to ws2003Moving to ws2003
Moving to ws2003Sumit Tambe
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event SourcingSergey Seletsky
 
Windows 2008 R2 Security
Windows 2008 R2 SecurityWindows 2008 R2 Security
Windows 2008 R2 SecurityAmit Gatenyo
 
Event Sourcing from the Trenches (with examples from .NET)
Event Sourcing from the Trenches (with examples from .NET)Event Sourcing from the Trenches (with examples from .NET)
Event Sourcing from the Trenches (with examples from .NET)Dennis Doomen
 
CQRS and ES with Lagom
CQRS and ES with LagomCQRS and ES with Lagom
CQRS and ES with LagomMiel Donkers
 
Reactive reference architecture
Reactive reference architectureReactive reference architecture
Reactive reference architectureMarkus Jura
 
The Next Step in AS3 Framework Evolution
The Next Step in AS3 Framework EvolutionThe Next Step in AS3 Framework Evolution
The Next Step in AS3 Framework EvolutionFITC
 
Migrating a Large AEM Project to Touch UI
Migrating a Large AEM Project to Touch UIMigrating a Large AEM Project to Touch UI
Migrating a Large AEM Project to Touch UIGregor Zurowski
 

Ähnlich wie CQRS and Event Sourcing with Akka, Cassandra and RabbitMQ (20)

Copenhagen ruby brigade november 2018
Copenhagen ruby brigade   november 2018Copenhagen ruby brigade   november 2018
Copenhagen ruby brigade november 2018
 
GraniteDS 360|Flex DC
GraniteDS 360|Flex DCGraniteDS 360|Flex DC
GraniteDS 360|Flex DC
 
MS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applicationsMS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applications
 
Cqrs and event sourcing in azure
Cqrs and event sourcing in azureCqrs and event sourcing in azure
Cqrs and event sourcing in azure
 
Ch01 Introduction to Exchange 2013
Ch01 Introduction to Exchange 2013Ch01 Introduction to Exchange 2013
Ch01 Introduction to Exchange 2013
 
Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new features
 
MSP-AzureDev101
MSP-AzureDev101MSP-AzureDev101
MSP-AzureDev101
 
DCV
DCVDCV
DCV
 
Sprint 207
Sprint 207Sprint 207
Sprint 207
 
Greenfield Development with CQRS
Greenfield Development with CQRSGreenfield Development with CQRS
Greenfield Development with CQRS
 
Moving to ws2003
Moving to ws2003Moving to ws2003
Moving to ws2003
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
 
Windows 2008 R2 Security
Windows 2008 R2 SecurityWindows 2008 R2 Security
Windows 2008 R2 Security
 
Resume
ResumeResume
Resume
 
Event Sourcing from the Trenches (with examples from .NET)
Event Sourcing from the Trenches (with examples from .NET)Event Sourcing from the Trenches (with examples from .NET)
Event Sourcing from the Trenches (with examples from .NET)
 
CQRS and ES with Lagom
CQRS and ES with LagomCQRS and ES with Lagom
CQRS and ES with Lagom
 
Reactive reference architecture
Reactive reference architectureReactive reference architecture
Reactive reference architecture
 
The Next Step in AS3 Framework Evolution
The Next Step in AS3 Framework EvolutionThe Next Step in AS3 Framework Evolution
The Next Step in AS3 Framework Evolution
 
Migrating a Large AEM Project to Touch UI
Migrating a Large AEM Project to Touch UIMigrating a Large AEM Project to Touch UI
Migrating a Large AEM Project to Touch UI
 
Azure webinar kolkata
Azure webinar kolkata Azure webinar kolkata
Azure webinar kolkata
 

Mehr von Miel Donkers

Instana - ClickHouse presentation
Instana - ClickHouse presentationInstana - ClickHouse presentation
Instana - ClickHouse presentationMiel 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
 

Mehr von Miel Donkers (6)

Instana - ClickHouse presentation
Instana - ClickHouse presentationInstana - ClickHouse presentation
Instana - ClickHouse presentation
 
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
 

KĂŒrzlich hochgeladen

Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
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
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
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.
 
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...gurkirankumar98700
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 

KĂŒrzlich hochgeladen (20)

Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
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...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Call Girls In Mukherjee Nagar đŸ“± 9999965857 đŸ€© Delhi đŸ«Š HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar đŸ“±  9999965857  đŸ€© Delhi đŸ«Š HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar đŸ“±  9999965857  đŸ€© Delhi đŸ«Š HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar đŸ“± 9999965857 đŸ€© Delhi đŸ«Š HOT AND SEXY VVIP 🍎 SE...
 
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 ...
 
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 

CQRS and Event Sourcing with Akka, Cassandra and RabbitMQ

  • 1. 1 CQRS & ES With Akka, Cassandra and RabbitMQ Miel Donkers, codecentric
  • 3. 2 . 2 What is CQRS
  • 4. 2 . 3 What is CQRS Command Query Responsibility Segregation
  • 5. 2 . 4 Traditional Architecture © Martin Fowler
  • 6. 2 . 5 CQRS Architecture © Martin Fowler
  • 7. 2 . 6 Storing data Simple approach Single database Normalized tables for write-side data Views for denormalizing data Keep queries simple
  • 8. 2 . 7 CQRS related to DDD DDD - Domain Driven Design Bounded Context Aggregate Command Event
  • 9. 2 . 8 What is ES
  • 10. 2 . 9 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.
  • 11. 2 . 10 CQRS & ES Combined
  • 12. 2 . 11 Architecture with Transactions © Microsoft - CQRS Journey
  • 13. 2 . 12 Architecture with Events © Microsoft - CQRS Journey
  • 14. 2 . 13 Architecture with Messages © Microsoft - CQRS Journey
  • 15. 2 . 14 The hard parts
  • 16. 2 . 15 Consistency Key feature for the Event Store Without transactions, much work needed to make as reliable Versioning / timestamps Eventual consistency
  • 17. 2 . 16 Error Handling Distinguish between business faults and errors. Errors can be re-tried. Business faults should have pre-determined reaction.
  • 18. 2 . 17 Other disadvantages Many moving parts, makes it hard to debug the system as a whole CQRS not for every bounded context
  • 20. 2 . 19 Advantages Task-based UI Read and write side can be optimized separately Debug in local environment Small components which are easy to update / ïŹx
  • 22. 2 . 21 User Aggregate Not Finished
  • 23. 2 . 22 User Repository private var users = Set.empty[User] override def receiveCommand: Receive = { case GetUsers => sender() ! users case AddUser(name) if users.exists(_.name == name) => sender() ! UserExists(name) case AddUser(user) => persist(user) { persistedUser => receiveRecover(persistedUser) sender() ! UserAdded(persistedUser) } } override def receiveRecover: Receive = { case user: User => users += user }
  • 24. 2 . 23 Event Sender private var unconfirmed = immutable.SortedMap.empty[Long, ActorPath] override def receive: Receive = { case Msg(deliveryId, user) => unconfirmed = unconfirmed.updated(deliveryId, sender().path) val headersMap = Map(RabbitMQConstants.MESSAGE_ID -> deliveryId, RabbitMQ camelSender ! CamelMessage(user.asJson.noSpaces, headersMap) case CamelMessage(_, headers) => val deliveryId: Long = headers.getOrElse(RabbitMQConstants.MESSAGE_ID, - unconfirmed.get(deliveryId).foreach( senderActor => { unconfirmed -= deliveryId context.actorSelection(senderActor) ! Confirm(deliveryId) }) case Status.Failure(ex) =>
  • 25. 2 . 24 Event Receiver override def receive: Receive = { case msg: CamelMessage => val body: Xor[Error, User] = decode[User](msg.bodyAs[String]) body.fold({ error => sender() ! Failure(error) }, { user => sender() ! Ack }) case _ => log.warning("Unexpected event received") }
  • 26. 2 . 25 Links Martin Fowler - CQRS Microsoft - CQRS Journey Akka Heiko Seeberger - Reactive Flows Demo
  • 29. 3 . 3 The End   Copyright 2016