SlideShare ist ein Scribd-Unternehmen logo
1 von 40
RealWorld Event Sourcing
and CQRS
Matthew Hawkins | @mattchawkins
Agenda
• Overview of my journey into CQRS, ES, and F#
• Explore different patterns, practices and architectures
• 4 Segments
1) Event Sourcing
2) F#
3) Domain Driven Design
4) CQRS
• Disclaimer:This is what I’ve found works (or doesn’t) for us.
• Fast paced, will be covering a lot of information
Traditional Monolithic System
• Concurrency issues (Locking)
• CRUD Design
• Multiple Models
• Lacking developer discipline
• Typically not very scalable
Client
Model-View-Controller
RDBMS
CQRS/DDD/ES System
Client
ReSTful API
Command Model
Consumes
Writes
Query Model
Event
Store
Denormalized
Projection
Publishes
Reads
• Reads/Writes Segregated
• Concurrency Handling
• Clear separation of concerns (Read
vs Domain Model)
• Requires developer discipline
• High-throughput, scalable
Part One
“A way of representing state by storing the
history of the application’s state”
What is Event Sourcing?
What is an Event Store?
An immutable append-only transaction log.
Stock
Traded
Account
Updated
Stock
Traded
Account
Updated
Account
Updated
Time
RDBMS vs ES (Event Sourcing)
Relational Database Event Sourcing
State Current State
Tables Streams
Schemas Buckets
… what is Event Sourcing? (Cont.)
• Event Sourcing is a practice
• Persistence occurs in an “event store”
• Related events compose an “event stream”
• Streams are in chronological order
• Capability to project / rehydrate models
• Majority of RDBMS use a transaction log behind-the-scenes
What is an event?
• Events are state delta’s
• Events are immutable
• Transient or persisted
• Wrapped in a message (Header, Payload)
• Possibly consumed by 3rd parties
• Can be classified as a Domain, Infrastructural or System event
• Most events are past-tense behaviors of the domain (Ex: StockTraded)
What does an event look like?
• Domain Event Example (In F#):
EventVersioning
• Events are persisted in a serialized representation
V1
V2
Event Stream
• Event Stream : Grouping of related events
Stock
Traded
Account
Updated
Stock
Traded
Account
Updated
Account
Updated
Time
100101101 100100 Stream ID
Functionalities of aTransaction Log
• Slice stream
Contiguous subset of the stream
• Probe stream
Returns max score/offset of stream used for concurrency/state version management
• Append stream
Writes to the end of a stream
• Scan stream
Returns a specific subset of the stream (example: scan all “account updated”)
• Get stream
Returns all events from a specific stream, typically used for model rehydration
Rehydration
• The process of querying an event stream (GET) and “applying” it to the
model.
• Allows deterministic rehydration to a given point in time, commonly;
“Current State”
Projections
• Denormalized representation of the model
• Eventually consistent to the write model
• Projections are typically aligned to a specific screen on the UI
• May be organized by Aggregate
Read Model Event Read Model
F#
• F# is a mature, open source, cross-platform, functional-first programming
language.
• Why F#? (With DDD & ES)?
• Self documenting, expressive code
• The type system (algebraic, composable) prevents incorrect state
• Immutable out-of-the-box (Structural equality for value types)
PartTwo
F#Type System Examples
• Comparison
Unit of Measure
RecordType
UnionType
Record withTuples
F# Competitive Advantage
• The code serves as a self-documenting ubiquitous language
• WAY LESS CODE!! Once you learn it
• You can design your domain model to not allow incorrect states at compile
time
• Forced to handle errors (at compile time)
• No nulls! (Alternatives such as Options<‘T> and Choice<‘T1,’T2..>)
Domain Driven Design
• What is DDD?
• When and why DDD?
• What it provides you and your team?
PartThree
Bounded Contexts
• One large model vs. Bounded Contexts
• Can be aligned to an autonomous service
• Can’t start a DDD project without a BC (Bounded Context)
Trading Hedging
Accounting Management
Entities
• Have identity
• Equality is based off identity
• Have behavior associated with them
Values
• No identity
• Immutable
• Structurally equatable
• Explicit type (primitives -> domain concept)
• May have localized behavior
Aggregates
• Abstract notion of
domain types
• Collection of entity
and value types
• Not-concrete
• Load/save aggregates
Aggregate Roots (DDD Context)
• All interaction with the aggregate (entities and values) goes through the
aggregate
• An AR is an Entity
• Manages consistency within the aggregate (all state change)
• Not to be confused with CQRS Aggregate root
Sagas
• Responsible for long-running business processes , “workflows”
• Allows for eventually consistent communication between aggregates
• Consume domain events, fire commands
• Events may be transient
TradeOrderCreated TradeExecuted TransactionRecieved
Command-Query Responsibility
Segregation (CQRS)
• What is CQRS?
• When and why CQRS?
Part Four
System Overview
Client
ReSTful API
Command Model
Consumes
Writes
Query Model
Event
Store
Denormalized
Projection
Publishes
Reads
ReSTful API
HTTPVerb API Action
GET Queries the Read Model
POST Command on Queue -> (Create Command)
PUT Command on Queue -> (Update Command)
DELETE Command on Queue -> (Delete Command)
API Request
API Command
Command Handler
Commands
• Instantiated in the API
• No validation is performed
except for deserialization
• Placed on the queue to go
to the Handler
Triggers
• API Commands are mapped to triggers in the Command Handler
• Triggers are granular domain actions.When fired against the Aggregate
root, yield an event. (Fire : ‘state-> ‘trigger -> ‘event)
• Allow for explicit pathways of state change (Business rules, clear model)
Command Handlers
Aggregate Fire Function
‘state -> ‘trigger -> ‘event
Events
• Domain events represent the delta state change of the model
• The “Fire” function on an Aggregate root yields an event
• Events are serialized and stored in the event store
• Once persisted, they’re broadcasted to interested parties
Event Handlers
• Consume events dispatched from the Event Store
• Commonly used for:
• Updating the Read Model
• Notifying a 3rd party system
• Sagas
CQRS Aggregate Roots
• Gatekeeper for:
• Triggers interacting the with Aggregate
• Model Rehydration (Events)
CQRS Aggregate Root
Sagas,Triggers, and Poly-Aggregate
Communication• Sagas
• Provide an eventually consistent way of communicating between aggregates
• Best used when the process :
• Is “long running” (greater than a few seconds)
• Has a lot of business rules
• Interacts with 3rd party systems
• Trigger Pattern
• Provide a consistent way of multiple aggregates communicating at the same time
• Best used when:
• Two or more aggregates need to be validated/interact atomically
• Triggers are still used with one aggregate at a time!
Projections
• Denormalized representations of the domain model
• Typically correlate to 1) One UI screen 2) An aggregate
• Very similar to domain model rehydration (Apply: ‘state -> ‘event -> ‘state)
• Eventually consistent. Should not be used on the “Command/write side”
• Can be different than the write model
Read Model Query Cache Projection
Event Handlers
Push to ->
API GET->
• geteventstore.com
• NEventStore (++ CommonDomain)
• Domain Driven Design by Eric Evans
• Fsharp.org
• GalaxE Solutions (@GalaxESolutions)
• QuickenLoans (@QLTechnology)
• Matt Hawkins (@MattCHawkins)
Still Interested?

Weitere ähnliche Inhalte

Was ist angesagt?

잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다Arawn Park
 
Asynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFutureAsynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFutureJosé Paumard
 
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsBest Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsJignesh Shah
 
NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?Anton Zadorozhniy
 
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버Heungsub Lee
 
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
 
Distributed Locking in Kubernetes
Distributed Locking in KubernetesDistributed Locking in Kubernetes
Distributed Locking in KubernetesRafał Leszko
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisDvir Volk
 
Communication in a Microservice Architecture
Communication in a Microservice ArchitectureCommunication in a Microservice Architecture
Communication in a Microservice ArchitecturePer Bernhardt
 
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
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureAlvaro Videla
 
MongoDB Performance Debugging
MongoDB Performance DebuggingMongoDB Performance Debugging
MongoDB Performance DebuggingMongoDB
 
MSA 전략 1: 마이크로서비스, 어떻게 디자인 할 것인가?
MSA 전략 1: 마이크로서비스, 어떻게 디자인 할 것인가?MSA 전략 1: 마이크로서비스, 어떻게 디자인 할 것인가?
MSA 전략 1: 마이크로서비스, 어떻게 디자인 할 것인가?VMware Tanzu Korea
 
Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Kafka Tutorial - Introduction to Apache Kafka (Part 1)Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Kafka Tutorial - Introduction to Apache Kafka (Part 1)Jean-Paul Azar
 
점진적인 레거시 웹 애플리케이션 개선 과정
점진적인 레거시 웹 애플리케이션 개선 과정점진적인 레거시 웹 애플리케이션 개선 과정
점진적인 레거시 웹 애플리케이션 개선 과정Arawn Park
 
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)충섭 김
 
Redis cluster
Redis clusterRedis cluster
Redis clusteriammutex
 
Distributed tracing using open tracing &amp; jaeger 2
Distributed tracing using open tracing &amp; jaeger 2Distributed tracing using open tracing &amp; jaeger 2
Distributed tracing using open tracing &amp; jaeger 2Chandresh Pancholi
 

Was ist angesagt? (20)

잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
 
Asynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFutureAsynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFuture
 
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsBest Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
 
NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?
 
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
 
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...
 
Distributed Locking in Kubernetes
Distributed Locking in KubernetesDistributed Locking in Kubernetes
Distributed Locking in Kubernetes
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Communication in a Microservice Architecture
Communication in a Microservice ArchitectureCommunication in a Microservice Architecture
Communication in a Microservice Architecture
 
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
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal Architecture
 
MongoDB Performance Debugging
MongoDB Performance DebuggingMongoDB Performance Debugging
MongoDB Performance Debugging
 
MSA 전략 1: 마이크로서비스, 어떻게 디자인 할 것인가?
MSA 전략 1: 마이크로서비스, 어떻게 디자인 할 것인가?MSA 전략 1: 마이크로서비스, 어떻게 디자인 할 것인가?
MSA 전략 1: 마이크로서비스, 어떻게 디자인 할 것인가?
 
Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Kafka Tutorial - Introduction to Apache Kafka (Part 1)Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Kafka Tutorial - Introduction to Apache Kafka (Part 1)
 
점진적인 레거시 웹 애플리케이션 개선 과정
점진적인 레거시 웹 애플리케이션 개선 과정점진적인 레거시 웹 애플리케이션 개선 과정
점진적인 레거시 웹 애플리케이션 개선 과정
 
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Redis cluster
Redis clusterRedis cluster
Redis cluster
 
Distributed tracing using open tracing &amp; jaeger 2
Distributed tracing using open tracing &amp; jaeger 2Distributed tracing using open tracing &amp; jaeger 2
Distributed tracing using open tracing &amp; jaeger 2
 

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
 
CQRS and ES with Lagom
CQRS and ES with LagomCQRS and ES with Lagom
CQRS and ES with LagomMiel Donkers
 
rest without put
rest without putrest without put
rest without putXiaojun REN
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemAndres Almiray
 
Patterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservicesPatterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservicesRachel Reese
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissAndres Almiray
 
Event sourcing with the GetEventStore
Event sourcing with the GetEventStoreEvent sourcing with the GetEventStore
Event sourcing with the GetEventStoreTerence Kruger
 
Ddd cqrs - Forat Latif
Ddd cqrs - Forat LatifDdd cqrs - Forat Latif
Ddd cqrs - Forat LatifCodemotion
 
Conference Marketing
Conference MarketingConference Marketing
Conference MarketingGary Rottman
 
Pulling them in: Content Marketing for Conference Organisers
Pulling them in: Content Marketing for Conference Organisers   Pulling them in: Content Marketing for Conference Organisers
Pulling them in: Content Marketing for Conference Organisers Typeset
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle BuildAndres Almiray
 
Gradle Glam: Plugis Galore
Gradle Glam: Plugis GaloreGradle Glam: Plugis Galore
Gradle Glam: Plugis GaloreAndres Almiray
 
Griffon: what's new and what's coming
Griffon: what's new and what's comingGriffon: what's new and what's coming
Griffon: what's new and what's comingAndres Almiray
 
Gradle Glam: Plugis Strike Back
Gradle Glam: Plugis Strike BackGradle Glam: Plugis Strike Back
Gradle Glam: Plugis Strike BackAndres Almiray
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle BuildAndres Almiray
 

Andere mochten auch (20)

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
 
CQRS and ES with Lagom
CQRS and ES with LagomCQRS and ES with Lagom
CQRS and ES with Lagom
 
Event Sourcing with php
Event Sourcing with phpEvent Sourcing with php
Event Sourcing with php
 
rest without put
rest without putrest without put
rest without put
 
CQRS is not Event Sourcing
CQRS is not Event SourcingCQRS is not Event Sourcing
CQRS is not Event Sourcing
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
 
Domain Event - The Hidden Gem of DDD
Domain Event - The Hidden Gem of DDDDomain Event - The Hidden Gem of DDD
Domain Event - The Hidden Gem of DDD
 
Patterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservicesPatterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservices
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
Event sourcing with the GetEventStore
Event sourcing with the GetEventStoreEvent sourcing with the GetEventStore
Event sourcing with the GetEventStore
 
Ddd cqrs - Forat Latif
Ddd cqrs - Forat LatifDdd cqrs - Forat Latif
Ddd cqrs - Forat Latif
 
Event Sourcing
Event SourcingEvent Sourcing
Event Sourcing
 
Conference Marketing
Conference MarketingConference Marketing
Conference Marketing
 
Pulling them in: Content Marketing for Conference Organisers
Pulling them in: Content Marketing for Conference Organisers   Pulling them in: Content Marketing for Conference Organisers
Pulling them in: Content Marketing for Conference Organisers
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 
Gradle Glam: Plugis Galore
Gradle Glam: Plugis GaloreGradle Glam: Plugis Galore
Gradle Glam: Plugis Galore
 
Griffon: what's new and what's coming
Griffon: what's new and what's comingGriffon: what's new and what's coming
Griffon: what's new and what's coming
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
 
Gradle Glam: Plugis Strike Back
Gradle Glam: Plugis Strike BackGradle Glam: Plugis Strike Back
Gradle Glam: Plugis Strike Back
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 

Ähnlich wie Real World Event Sourcing and CQRS

Patterns of Distributed Application Design
Patterns of Distributed Application DesignPatterns of Distributed Application Design
Patterns of Distributed Application DesignGlobalLogic Ukraine
 
Reactive Development: Commands, Actors and Events. Oh My!!
Reactive Development: Commands, Actors and Events.  Oh My!!Reactive Development: Commands, Actors and Events.  Oh My!!
Reactive Development: Commands, Actors and Events. Oh My!!David Hoerster
 
Patterns of Distributed Application Design
Patterns of Distributed Application DesignPatterns of Distributed Application Design
Patterns of Distributed Application DesignOrkhan Gasimov
 
Azure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challengesAzure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challengesIvo Andreev
 
Azure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud DatabaseAzure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud DatabaseBizTalk360
 
Introduction to CQRS - command and query responsibility segregation
Introduction to CQRS - command and query responsibility segregationIntroduction to CQRS - command and query responsibility segregation
Introduction to CQRS - command and query responsibility segregationAndrew Siemer
 
The End of a Myth: Ultra-Scalable Transactional Management
The End of a Myth: Ultra-Scalable Transactional ManagementThe End of a Myth: Ultra-Scalable Transactional Management
The End of a Myth: Ultra-Scalable Transactional ManagementRicardo Jimenez-Peris
 
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRS
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRSSoftwerkskammer Lübeck 08/2018 Event Sourcing and CQRS
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRSDaniel Bimschas
 
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...confluent
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesAmazon Web Services
 
Marco Mancuso - Data Context Interaction
Marco Mancuso - Data Context InteractionMarco Mancuso - Data Context Interaction
Marco Mancuso - Data Context InteractioncosenzaLab
 
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...confluent
 
Iot cloud service v2.0
Iot cloud service v2.0Iot cloud service v2.0
Iot cloud service v2.0Vinod Wilson
 
Festive Tech Calendar 2021
Festive Tech Calendar 2021Festive Tech Calendar 2021
Festive Tech Calendar 2021Callon Campbell
 
Enterprise Software Development Patterns
Enterprise Software Development PatternsEnterprise Software Development Patterns
Enterprise Software Development PatternsJosh Lane
 
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...confluent
 
The Meteor Framework
The Meteor FrameworkThe Meteor Framework
The Meteor FrameworkDamien Magoni
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersSATOSHI TAGOMORI
 

Ähnlich wie Real World Event Sourcing and CQRS (20)

Patterns of Distributed Application Design
Patterns of Distributed Application DesignPatterns of Distributed Application Design
Patterns of Distributed Application Design
 
Reactive Development: Commands, Actors and Events. Oh My!!
Reactive Development: Commands, Actors and Events.  Oh My!!Reactive Development: Commands, Actors and Events.  Oh My!!
Reactive Development: Commands, Actors and Events. Oh My!!
 
Patterns of Distributed Application Design
Patterns of Distributed Application DesignPatterns of Distributed Application Design
Patterns of Distributed Application Design
 
Azure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challengesAzure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challenges
 
Azure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud DatabaseAzure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud Database
 
Introduction to CQRS - command and query responsibility segregation
Introduction to CQRS - command and query responsibility segregationIntroduction to CQRS - command and query responsibility segregation
Introduction to CQRS - command and query responsibility segregation
 
Cqrs+es
Cqrs+esCqrs+es
Cqrs+es
 
Cqrs+es
Cqrs+esCqrs+es
Cqrs+es
 
The End of a Myth: Ultra-Scalable Transactional Management
The End of a Myth: Ultra-Scalable Transactional ManagementThe End of a Myth: Ultra-Scalable Transactional Management
The End of a Myth: Ultra-Scalable Transactional Management
 
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRS
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRSSoftwerkskammer Lübeck 08/2018 Event Sourcing and CQRS
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRS
 
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Marco Mancuso - Data Context Interaction
Marco Mancuso - Data Context InteractionMarco Mancuso - Data Context Interaction
Marco Mancuso - Data Context Interaction
 
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
 
Iot cloud service v2.0
Iot cloud service v2.0Iot cloud service v2.0
Iot cloud service v2.0
 
Festive Tech Calendar 2021
Festive Tech Calendar 2021Festive Tech Calendar 2021
Festive Tech Calendar 2021
 
Enterprise Software Development Patterns
Enterprise Software Development PatternsEnterprise Software Development Patterns
Enterprise Software Development Patterns
 
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
 
The Meteor Framework
The Meteor FrameworkThe Meteor Framework
The Meteor Framework
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
 

Kürzlich hochgeladen

KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 

Kürzlich hochgeladen (20)

KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 

Real World Event Sourcing and CQRS

  • 1. RealWorld Event Sourcing and CQRS Matthew Hawkins | @mattchawkins
  • 2. Agenda • Overview of my journey into CQRS, ES, and F# • Explore different patterns, practices and architectures • 4 Segments 1) Event Sourcing 2) F# 3) Domain Driven Design 4) CQRS • Disclaimer:This is what I’ve found works (or doesn’t) for us. • Fast paced, will be covering a lot of information
  • 3. Traditional Monolithic System • Concurrency issues (Locking) • CRUD Design • Multiple Models • Lacking developer discipline • Typically not very scalable Client Model-View-Controller RDBMS
  • 4. CQRS/DDD/ES System Client ReSTful API Command Model Consumes Writes Query Model Event Store Denormalized Projection Publishes Reads • Reads/Writes Segregated • Concurrency Handling • Clear separation of concerns (Read vs Domain Model) • Requires developer discipline • High-throughput, scalable
  • 5. Part One “A way of representing state by storing the history of the application’s state” What is Event Sourcing?
  • 6. What is an Event Store? An immutable append-only transaction log. Stock Traded Account Updated Stock Traded Account Updated Account Updated Time
  • 7. RDBMS vs ES (Event Sourcing) Relational Database Event Sourcing State Current State Tables Streams Schemas Buckets
  • 8. … what is Event Sourcing? (Cont.) • Event Sourcing is a practice • Persistence occurs in an “event store” • Related events compose an “event stream” • Streams are in chronological order • Capability to project / rehydrate models • Majority of RDBMS use a transaction log behind-the-scenes
  • 9. What is an event? • Events are state delta’s • Events are immutable • Transient or persisted • Wrapped in a message (Header, Payload) • Possibly consumed by 3rd parties • Can be classified as a Domain, Infrastructural or System event • Most events are past-tense behaviors of the domain (Ex: StockTraded)
  • 10. What does an event look like? • Domain Event Example (In F#):
  • 11. EventVersioning • Events are persisted in a serialized representation V1 V2
  • 12. Event Stream • Event Stream : Grouping of related events Stock Traded Account Updated Stock Traded Account Updated Account Updated Time 100101101 100100 Stream ID
  • 13. Functionalities of aTransaction Log • Slice stream Contiguous subset of the stream • Probe stream Returns max score/offset of stream used for concurrency/state version management • Append stream Writes to the end of a stream • Scan stream Returns a specific subset of the stream (example: scan all “account updated”) • Get stream Returns all events from a specific stream, typically used for model rehydration
  • 14. Rehydration • The process of querying an event stream (GET) and “applying” it to the model. • Allows deterministic rehydration to a given point in time, commonly; “Current State”
  • 15. Projections • Denormalized representation of the model • Eventually consistent to the write model • Projections are typically aligned to a specific screen on the UI • May be organized by Aggregate Read Model Event Read Model
  • 16. F# • F# is a mature, open source, cross-platform, functional-first programming language. • Why F#? (With DDD & ES)? • Self documenting, expressive code • The type system (algebraic, composable) prevents incorrect state • Immutable out-of-the-box (Structural equality for value types) PartTwo
  • 17. F#Type System Examples • Comparison Unit of Measure RecordType UnionType Record withTuples
  • 18. F# Competitive Advantage • The code serves as a self-documenting ubiquitous language • WAY LESS CODE!! Once you learn it • You can design your domain model to not allow incorrect states at compile time • Forced to handle errors (at compile time) • No nulls! (Alternatives such as Options<‘T> and Choice<‘T1,’T2..>)
  • 19. Domain Driven Design • What is DDD? • When and why DDD? • What it provides you and your team? PartThree
  • 20. Bounded Contexts • One large model vs. Bounded Contexts • Can be aligned to an autonomous service • Can’t start a DDD project without a BC (Bounded Context) Trading Hedging Accounting Management
  • 21. Entities • Have identity • Equality is based off identity • Have behavior associated with them
  • 22. Values • No identity • Immutable • Structurally equatable • Explicit type (primitives -> domain concept) • May have localized behavior
  • 23. Aggregates • Abstract notion of domain types • Collection of entity and value types • Not-concrete • Load/save aggregates
  • 24. Aggregate Roots (DDD Context) • All interaction with the aggregate (entities and values) goes through the aggregate • An AR is an Entity • Manages consistency within the aggregate (all state change) • Not to be confused with CQRS Aggregate root
  • 25. Sagas • Responsible for long-running business processes , “workflows” • Allows for eventually consistent communication between aggregates • Consume domain events, fire commands • Events may be transient TradeOrderCreated TradeExecuted TransactionRecieved
  • 26. Command-Query Responsibility Segregation (CQRS) • What is CQRS? • When and why CQRS? Part Four
  • 27. System Overview Client ReSTful API Command Model Consumes Writes Query Model Event Store Denormalized Projection Publishes Reads
  • 28. ReSTful API HTTPVerb API Action GET Queries the Read Model POST Command on Queue -> (Create Command) PUT Command on Queue -> (Update Command) DELETE Command on Queue -> (Delete Command) API Request API Command Command Handler
  • 29. Commands • Instantiated in the API • No validation is performed except for deserialization • Placed on the queue to go to the Handler
  • 30. Triggers • API Commands are mapped to triggers in the Command Handler • Triggers are granular domain actions.When fired against the Aggregate root, yield an event. (Fire : ‘state-> ‘trigger -> ‘event) • Allow for explicit pathways of state change (Business rules, clear model)
  • 32. Aggregate Fire Function ‘state -> ‘trigger -> ‘event
  • 33. Events • Domain events represent the delta state change of the model • The “Fire” function on an Aggregate root yields an event • Events are serialized and stored in the event store • Once persisted, they’re broadcasted to interested parties
  • 34. Event Handlers • Consume events dispatched from the Event Store • Commonly used for: • Updating the Read Model • Notifying a 3rd party system • Sagas
  • 35. CQRS Aggregate Roots • Gatekeeper for: • Triggers interacting the with Aggregate • Model Rehydration (Events)
  • 37. Sagas,Triggers, and Poly-Aggregate Communication• Sagas • Provide an eventually consistent way of communicating between aggregates • Best used when the process : • Is “long running” (greater than a few seconds) • Has a lot of business rules • Interacts with 3rd party systems • Trigger Pattern • Provide a consistent way of multiple aggregates communicating at the same time • Best used when: • Two or more aggregates need to be validated/interact atomically • Triggers are still used with one aggregate at a time!
  • 38. Projections • Denormalized representations of the domain model • Typically correlate to 1) One UI screen 2) An aggregate • Very similar to domain model rehydration (Apply: ‘state -> ‘event -> ‘state) • Eventually consistent. Should not be used on the “Command/write side” • Can be different than the write model
  • 39. Read Model Query Cache Projection Event Handlers Push to -> API GET->
  • 40. • geteventstore.com • NEventStore (++ CommonDomain) • Domain Driven Design by Eric Evans • Fsharp.org • GalaxE Solutions (@GalaxESolutions) • QuickenLoans (@QLTechnology) • Matt Hawkins (@MattCHawkins) Still Interested?

Hinweis der Redaktion

  1. -Welcome to Real World Event Sourcing and CQRS -Matt Hawkins, Consultant @ GalaxE Solutions – primary client Quicken Loans Capital Markets
  2. Talk Summary, Agenda, Goal Poll of the Audience Why am I an advocate?
  3. -This is Segment 0 -> brief introduction to topics covered so you have context into what I’ll be speaking about -Comparison of Monolithic vs CQRS system -
  4. Overview of the architecture Technologies chosen Dive into all areas brifly, tie back to talk plan Talk real world example vs what I’ll be showing
  5. Deterministically audit data No-loss biz case
  6. -DDD is an approach to software development for complex systems, or where you can gain a competitive advantage from a biz perspective. Invented by Eric Evans Not a silver bullet, a lot is obvious once you read it but it is a learning curve Crafstmanship, focus on the BIZ, -Ubiqitous language Your team: Everyone has a deep focus on the “domain model”, in CQRS, there is one “write model” Everyone speaks the same colloquialisms and language around the domain Designed for evolution and a focus on craftsmanship Final goal : to build better software
  7. -What would ordinarily be a very large model, is broken into bounded contexts -Bounded contexts are typically by division/organization/domain focus (different people) -May have different rules or language -Their systems may evolve differently over time -Two bounded contexts may speak the same WORDS but have different meanings -More management from a development perspective
  8. Basically separating the reads and writes Pairs well with DDD and ES High throughput/Very fast reads Separtion of responsibility Not a silver bulled
  9. PUTs to multiple triggers PATCH this logic may be handled in the API
  10. Sagas are a model in themselves, they orchestrate the process and can be more robust than tirggers You
  11. Push vs Pull style