![Page 1: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/1.jpg)
My first year with event-sourcingAnd a little bit about tracking your beer
Tim Huijzers
![Page 2: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/2.jpg)
Tim HuijzersDragem or Webbaard
Developer @ drukwerkdeal.nlFounder of DeventerPHP
Usergroup
![Page 3: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/3.jpg)
![Page 4: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/4.jpg)
First Try● Limited knowledge
● No experience
● No ES framework
● Doomed from the start
![Page 5: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/5.jpg)
Second Try● Limited knowledge
● Limited experience
● New Framework
● New DI manager
● New ES Framework
● Doomed To Fail
![Page 6: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/6.jpg)
Third Try● Some knowledge
● Some experience
● Known framework
● known database
● known ES framework
● Still doomed
![Page 7: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/7.jpg)
![Page 8: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/8.jpg)
![Page 9: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/9.jpg)
BeerWarehouse
![Page 10: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/10.jpg)
Why use Event Sourcing
![Page 11: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/11.jpg)
CRUD
![Page 12: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/12.jpg)
We will save a new entry in our system because we just bought it and will store it in the fridge for later.
![Page 13: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/13.jpg)
If we change the location the system only knows about that location.
![Page 14: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/14.jpg)
We drank it so it’s not in the system anymore
![Page 15: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/15.jpg)
We want to keep a history of everything we drank.
![Page 16: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/16.jpg)
I want to know when I drank this in my history.
![Page 17: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/17.jpg)
But that’s only for new beers.
![Page 18: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/18.jpg)
![Page 19: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/19.jpg)
Events
![Page 20: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/20.jpg)
Same Information as before + Explicit action about what happened
![Page 21: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/21.jpg)
Make Small Events
![Page 22: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/22.jpg)
Removed Location and changed name because in the real world you might not know this yet.
![Page 23: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/23.jpg)
When returning home I put the beer in my fridge
![Page 24: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/24.jpg)
I need room in my fridge so I take it out. Using the same Event
![Page 25: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/25.jpg)
And at last a event about when I consumed it.
![Page 26: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/26.jpg)
![Page 27: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/27.jpg)
Crud● I know what beer I have.
● I know when it was consumed.
● I know where it is.
Event-Sourcing● I know what beer I have.
● I know when it was consumed.
● I know where it is.
● I know where it was before.
● I know when it was moved.
● I know where it was at any point in
time
● I know how many times it was moved.
● I know when it was added to the
system.
● I know what else was moved in that
day.
![Page 28: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/28.jpg)
“Every software program relates to some activity or interest of its user.”
Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software
![Page 29: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/29.jpg)
![Page 30: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/30.jpg)
When To Use Event Sourcing
![Page 31: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/31.jpg)
● You need an audit log
● You like scalability
● You want to separate the read and write of an application
● You want to replay event on a dev machine to get an accurate
situation of what the state was at a point in time.
● You want reporting but don’t know what yet.
● You are done with mapping objects to tables
![Page 32: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/32.jpg)
When NOT To Use Event Sourcing
![Page 33: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/33.jpg)
● You only need a simple CRUD system.
● You are processing a lot of personal data.
● You just want to query a lot of things on the DB
● You are starting on a big project for production
![Page 34: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/34.jpg)
Event Sourcing in code
![Page 35: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/35.jpg)
Prooph
![Page 36: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/36.jpg)
http://getprooph.org/
![Page 37: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/37.jpg)
![Page 38: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/38.jpg)
Command
![Page 39: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/39.jpg)
![Page 40: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/40.jpg)
![Page 41: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/41.jpg)
![Page 42: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/42.jpg)
![Page 43: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/43.jpg)
Command Handler
![Page 44: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/44.jpg)
![Page 45: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/45.jpg)
![Page 46: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/46.jpg)
Aggregate
![Page 47: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/47.jpg)
![Page 48: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/48.jpg)
Event
![Page 49: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/49.jpg)
![Page 50: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/50.jpg)
![Page 51: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/51.jpg)
![Page 52: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/52.jpg)
![Page 53: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/53.jpg)
Back to the Aggregate
![Page 54: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/54.jpg)
![Page 55: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/55.jpg)
![Page 56: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/56.jpg)
![Page 57: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/57.jpg)
![Page 58: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/58.jpg)
Think About Side Effects
![Page 59: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/59.jpg)
![Page 60: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/60.jpg)
![Page 61: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/61.jpg)
![Page 62: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/62.jpg)
What about Symfony?
![Page 63: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/63.jpg)
![Page 64: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/64.jpg)
![Page 65: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/65.jpg)
Structuring your application
![Page 66: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/66.jpg)
![Page 67: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/67.jpg)
Understanding the DB
![Page 68: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/68.jpg)
![Page 69: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/69.jpg)
How many beers do I have?
![Page 70: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/70.jpg)
How many different styles do I have?
![Page 71: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/71.jpg)
How many beers have I drank last 30 days?
![Page 72: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/72.jpg)
Projection
![Page 73: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/73.jpg)
A Projection allows you to loop through all event (past and present) and build your
own views.
● Read Model
○ Define the data you would like to use.
● Projection
○ Loops through the events and applies that data to your view
● Finder
○ Helps you find data from that view.
![Page 74: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/74.jpg)
![Page 75: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/75.jpg)
![Page 76: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/76.jpg)
![Page 77: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/77.jpg)
![Page 78: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/78.jpg)
Pitfalls
![Page 79: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/79.jpg)
Refactoring is harder, think about your architecture
![Page 80: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/80.jpg)
![Page 81: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/81.jpg)
Versioning● Change an Event but support the old version
● Make a new Event
● Make the Event right from the start
![Page 82: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/82.jpg)
Something wrong with the event
![Page 83: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/83.jpg)
Event are immutable, So don’t change them● Try solving it another way first.
● Correct errors with new events
● Try a upcaster
● Make a new stream and fill it with mutated events (and test)
● Change the events in the database
![Page 84: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/84.jpg)
But what if I have like 100 trillion gazillion events?
![Page 85: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/85.jpg)
![Page 86: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/86.jpg)
Snapshots
![Page 87: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/87.jpg)
You Do Not Need Snapshots From The start
![Page 88: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/88.jpg)
Trigger on Event Count
![Page 89: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/89.jpg)
Pure Event Sourcing Is Not A Holy Grail
![Page 90: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/90.jpg)
Do Not Save Personal Data In Events
![Page 91: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/91.jpg)
Make Projections For All You Lists
![Page 92: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/92.jpg)
Try It In A Hackathon First
![Page 93: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/93.jpg)
Most Of The Time Your DB Is Not Holy
![Page 94: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/94.jpg)
What Now?
![Page 95: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/95.jpg)
http://getprooph.org/
![Page 96: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/96.jpg)
![Page 97: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/97.jpg)
Sourcehttps://github.com/prooph/proophessor-do-symfony
http://getprooph.org/
![Page 98: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/98.jpg)
Other Tools● Broadway
○ No Upcaster,
○ No Snapshots,
○ No Replaying
● Axon
○ Upcasting by MessageFactory,
○ Snapshots by Trigger on event count,
○ Replaying by Example code for replay
● Akka
○ Upcasting by Event Adapter,
○ Snapshots decided by actor,
○ Replaying
![Page 99: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/99.jpg)
![Page 100: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/100.jpg)
Thanks, Any Questions?
Example code from talk on: https://github.com/webbaard/BeerWarehouse
Slides of this talk on cfp.owncloud.com: https://cfp.owncloud.com/occon18/talk/XFB9PF/
![Page 101: My first year with event-sourcing · Event-Sourcing I know what beer I have. I know when it was consumed. I know where it is. I know where it was before. I know when it was moved](https://reader033.vdocuments.net/reader033/viewer/2022042321/5f0bad127e708231d431abb2/html5/thumbnails/101.jpg)