Eventsourcing - From Zero to Working Prototype
summary
Demos a working eventsourcing prototype built with PHP 8.1, Composer, Docker and SQLite event store that records immutable domain events (temperature recorded → insert-only) and projects them into read models. Implements projections (last and average temperature), a simple command bus and policies that emit a send-alert command when temperature < 0; optimistic locking uses an aggregate_id+version unique index so concurrent updates fail safely. Uses PSL/Valinor for typed mapping and Doctrine migrations for schema; example scripts run end-to-end in the workshop.
AI-written summary · about
chapters (12)
- 0:00Introduction to event sourcing
- 1:09Traditional data mutation vs event sourcing
- 10:45Event store and CQRS basics
- 25:13Domain events explained
- 31:56Exercise 1: Record temperature event
- 1:11:54Projections and read models
- 1:38:21Exercise 3: Average temperature projection
- 2:01:29Policies and command handling
- 2:15:56Exercise 4: Temperature alert policy
- 2:30:12Aggregates and state machines
- 2:40:08Exercise 5: Payment aggregate
- 2:57:13Q&A and closing
