From the course: Software Architecture: Patterns for Developers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Event sourcing
From the course: Software Architecture: Patterns for Developers
Event sourcing
- [Instructor] In event sourcing, we store events in the database, not the lost state of objects. Events are things that have happened in the past. If you want to know what the current state is of a certain entity, you apply all previous events to a new object. This is called rehydration or event replay. A great advantage of event sourcing is the trace you build up for each entity. You can see exactly what happened to an entity and with some extra metadata, you can build an audit trail which gives you insight into when events occurred and who or what triggered them. Speaking in terms of events, also maps greatly to the business language, making it easier to communicate with stakeholders. Finally, if there is a bug in the handling of an event which leads to a wrong state of an entity, we can simply fix the bug in the event handler, and next time we replay the events, our entity will be in the correct state. There is no need to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.