state or events - goto conference...event sourcing ensures that all changes to application state are...
TRANSCRIPT
![Page 1: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/1.jpg)
© 2017 Pivotal Software, Inc. All rights reserved.@kennybastani @JakubPilimon
State or events?
!1
State or Events? Kenny Bastani Jakub Pilimon
![Page 2: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/2.jpg)
Kenny Bastani
@kennybastani
Global CTO @Pivotal
![Page 3: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/3.jpg)
![Page 4: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/4.jpg)
© 2017 Pivotal Software, Inc. All rights reserved.@kennybastani @JakubPilimon
State or events?
!4
SZCZEBRZESZYNCHRZĄSZCZYŻEWOSZYCE
![Page 5: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/5.jpg)
© 2017 Pivotal Software, Inc. All rights reserved.@kennybastani
The agenda• Event sourcing, a history
• Why event sourcing?
• Apache Kafka and the immutable log
• Event-driven microservices
• Reference architecture
!5
![Page 6: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/6.jpg)
© 2017 Pivotal Software, Inc. All rights reserved.@kennybastani @JakubPilimon
Event sourcing
A mystery, a history…
!6
![Page 7: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/7.jpg)
Origin story
![Page 8: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/8.jpg)
Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also use the event log to reconstruct past states.
We can determine the application state at any point in time. We do this by starting with a blank state and rerunning the events up to a particular time. –Martin Fowler
![Page 9: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/9.jpg)
Did Martin Fowler invent event sourcing?
![Page 10: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/10.jpg)
Edgar Allan Poe (1804-1849)
We appreciate time by events alone. For this reason we define time (somewhat improperly) as the succession of events; but the fact itself--that events are our sole means of appreciating time-- [leads to] the erroneous idea that events are time--that the more numerous the events, the longer the time; and the converse.
![Page 11: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/11.jpg)
Did Edgar Allan Poe invent event sourcing?
Lol no…
![Page 12: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/12.jpg)
Ship
Chip Log15th-16th Century
Drag
Knots
Ocean
Log ReelLog-line
![Page 13: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/13.jpg)
© 2017 Pivotal Software, Inc. All rights reserved.@kennybastani
The Poe connection• Poe was obsessed with the idea of event sourcing for much of his life. • But in his time, things were commonly measured using a form of event
sourcing, like the knots on the log-line for measuring the speed of ships.
• Most software is built on metaphors. The problem is, we’ve forgotten the metaphors have meaning.
!13
![Page 14: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/14.jpg)
Marginalia, Edgar Allan Poe, 1849
![Page 15: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/15.jpg)
Marginalia, Edgar Allan Poe, 1849
![Page 16: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/16.jpg)
Ship
Chip Log15th-16th Century
Events (Objects)
Aggregation takes causal events across space and time andsummarizes it as a single object that’s easier to store in memory
TimeSpace
![Page 17: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/17.jpg)
All great software is built on metaphors
Desktop
Cloud
Web
Infrastructure
Virtual MachineState
Events
Services
Logs
Kernel
Tablets
Application
Instance
SpaceTimestamp
Memory
Containers
Database
Platform
Computer
RefactorFiles Pages
Documents
![Page 18: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/18.jpg)
The metaphors mean something• There’s an underlying abstraction to our own humanity and it has an
intimate connection to the virtual world we are building • The desktop computer replaced actual desktops by replacing the
abstract functionality of the desktop • The virtual machine replaced the server by virtualizing the abstract
functionality of the hardware
![Page 19: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/19.jpg)
But ultimately, it’s hard to keep track of all the layers.
![Page 20: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/20.jpg)
Eventually we get lost in abstraction.
![Page 21: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/21.jpg)
Serverless
Microservices
NoSQLSOA
Middleware
All confusing software is built on nonsense
DevOps
ESB
![Page 22: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/22.jpg)
I’m not saying microservices, DevOps, and serverless are nonsense.
![Page 23: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/23.jpg)
I’m saying that metaphors make good ideas more durable to nonsensical interpretation.
![Page 24: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/24.jpg)
Ship
Chip Log15th-16th Century
Drag
Knots
Ocean
Log ReelLog-line
LOG!
![Page 25: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/25.jpg)
LOG!
![Page 26: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/26.jpg)
![Page 27: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/27.jpg)
© 2017 Pivotal Software, Inc. All rights reserved.@kennybastani @JakubPilimon
Apache Kafka
The immutable log as the source of truth
!27
![Page 28: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/28.jpg)
Time-ordered events
![Page 29: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/29.jpg)
Store state as a log of events
https://www.confluent.io/blog/messaging-single-source-truth/
![Page 30: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/30.jpg)
Ship
Chip Log15th-16th Century
Drag
Knots
Ocean
Log ReelLog-line
It’s the same thing, but way before software
![Page 31: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/31.jpg)
![Page 32: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/32.jpg)
© 2017 Pivotal Software, Inc. All rights reserved.@kennybastani @JakubPilimon
Motivations
What’s the benefit of managing state in a distributed system?
!32
![Page 33: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/33.jpg)
Typical way of managing state
Account (pending,
10$)Account (active,
10$)
Account (archived,
10$)
Account (suspended,
10$)
![Page 34: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/34.jpg)
State machine
Account (pending,
10$)Account (active,
10$)
Account (archived,
10$)
Account (suspended,
10$)
![Page 35: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/35.jpg)
Audit of states and transitions
Account (pending,
10$)Account (active, 10$)
Account (archived,
10$)
Account (active, 15$)
![Page 36: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/36.jpg)
Event SourcingAggregates can be used to generate the consistent state of any object
It provides an audit trail that can be replayed to generate the state of an object from any point in time
It provides the many inputs necessary for analyzing data using event stream processing
It enables the use of compensating transactions to rollback events leading to an inconsistent application state
![Page 37: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/37.jpg)
So why aren’t we doing it everywhere?
![Page 38: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/38.jpg)
Because storing state as an immutable log of events for domain data didn’t make sense in a time B.C.
![Page 39: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/39.jpg)
B.C. = Before Cloud
– Andrew Clay Shafer
![Page 40: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/40.jpg)
https://www.confluent.io/blog/messaging-single-source-truth/
![Page 41: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/41.jpg)
https://www.confluent.io/blog/messaging-single-source-truth/
![Page 42: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/42.jpg)
The Immutable Log
https://www.confluent.io/blog/messaging-single-source-truth/
![Page 43: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/43.jpg)
The Immutable Log
![Page 44: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/44.jpg)
Event Sourcing and GDPR
What if somebody requests to have their immutable data removed from
a log?
![Page 45: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/45.jpg)
How about event-driven (micro)services?
![Page 46: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/46.jpg)
There are no foreign key constraints between (micro)services.
![Page 47: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/47.jpg)
Domain Graph
![Page 48: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/48.jpg)
Domain Relationships
![Page 49: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/49.jpg)
No foreign key constraints across services
ForeignKey
Relationships
PRODUCTSKUS
(Product ID)
![Page 50: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/50.jpg)
Distributed joins are slow (reads)
![Page 51: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/51.jpg)
Distributed transactions are brittle (writes)
![Page 52: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/52.jpg)
(Micro)service joins
• Services are organized using domain-driven design
• Services cannot own domain data from two different bounded contexts
• Complex joins (reads) are inevitable
• Avoid distributed transactions (write)
![Page 53: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/53.jpg)
What is CQRS?
CQRS (Command Query Responsibility Segregation) is a pattern for separating handlers for commands and
queries.
Handlers synchronize by turning events into materialized views.
![Page 54: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/54.jpg)
How do I do CQRS in a distributed system?
Let’s look at a system architecture that uses Spring Boot
![Page 55: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/55.jpg)
COMMANDSGENERATE
EVENTS
![Page 56: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/56.jpg)
EVENTSARE BROADCASTED TO OTHER SERVICES
![Page 57: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/57.jpg)
EVENT LISTENERSBUILD QUERY
MODELS
![Page 58: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/58.jpg)
API GATEWAYS HIDE THEIMPLEMENTATION DETAILS
API API
![Page 59: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/59.jpg)
READING YOUR OWN WRITES?
WRITE API READ API
![Page 60: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/60.jpg)
© 2017 Pivotal Software, Inc. All rights reserved.@kennybastani @JakubPilimon
Reference architectureCreating a social network as microservices
!60
![Page 61: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/61.jpg)
How do you do friend of a friend queries with microservices?
![Page 62: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/62.jpg)
User User
UserUser User
Friend
Friend FriendFriendFriend
![Page 63: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/63.jpg)
User User
UserUser User
Friend
Friend FriendFriendFriend
Day 1 of building microservices
Day 2 of building microservices…
![Page 64: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/64.jpg)
Materialized views
![Page 65: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/65.jpg)
Create aggregate views from event data
![Page 66: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/66.jpg)
![Page 67: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/67.jpg)
• Manage the storage of domain data that it owns.
• Produce the API contract for the domain data that it owns.
• Produce events when the state of any domain data changes.
• Maintain relationship integrity to domain data owned by other services.
![Page 68: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/68.jpg)
• Subscribe to domain events emitted by separate domain services.
• Maintain an ordered immutable event log for events it receives.
• Create connected query projections of distributed domain data.
• Provide performant read-access to complex views of domain data.
![Page 70: State or Events - GOTO Conference...Event Sourcing ensures that all changes to application state are stored as a sequence of events. Not only can we query these events, we can also](https://reader034.vdocuments.mx/reader034/viewer/2022042303/5ece570fa59d69109e45df0b/html5/thumbnails/70.jpg)
© 2017 Pivotal Software, Inc. All rights reserved.@kennybastani @JakubPilimon
Thanks!
Q/A
!70
https://github.com/kbastani/event-sourcing-microservices-basics
kennybastani.com
Thanks!
Q/A
https://github.com/kbastani/event-sourcing-microservices-basics
https://github.com/ddd-by-examples/all-things-cqrs
https://github.com/ddd-by-examples/event-source-cqrs-sample