35 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2017-08-05 23:33:08 +03:00
---
layout: pattern
title: Event Sourcing
folder: event-sourcing
permalink: /patterns/event-sourcing/
2017-08-13 01:36:52 +03:00
categories: Architectural
2017-08-05 23:33:08 +03:00
tags:
2020-07-26 11:30:42 +03:00
- Performance
- Cloud distributed
2017-08-05 23:33:08 +03:00
---
## Intent
2017-08-13 01:36:52 +03:00
Instead of storing just the current state of the data in a domain, use an append-only store to record the full series of actions taken on that data. The store acts as the system of record and can be used to materialize the domain objects. This can simplify tasks in complex domains, by avoiding the need to synchronize the data model and the business domain, while improving performance, scalability, and responsiveness. It can also provide consistency for transactional data, and maintain full audit trails and history that can enable compensating actions.
## Class diagram
2017-08-13 01:36:52 +03:00
![alt text](./etc/event-sourcing.png "Event Sourcing")
2017-08-05 23:33:08 +03:00
## Applicability
Use the Event Sourcing pattern when
2017-08-13 01:36:52 +03:00
* You need very high performance on persisting your application state even your application state have a complex relational data structure
* You need log of changes of your application state and ability to restore a state of any moment in time.
* You need to debug production problems by replaying the past events.
## Real world examples
2020-09-16 13:44:50 +02:00
* [The Lmax Architecture](https://martinfowler.com/articles/lmax.html)
2017-08-05 23:33:08 +03:00
## Credits
2020-09-16 13:44:50 +02:00
* [Martin Fowler - Event Sourcing](https://martinfowler.com/eaaDev/EventSourcing.html)
2020-10-04 14:32:50 +03:00
* [Event Sourcing in Microsoft's documentation](https://docs.microsoft.com/en-us/azure/architecture/patterns/event-sourcing)
2020-09-16 13:44:50 +02:00
* [Reference 3: Introducing Event Sourcing](https://msdn.microsoft.com/en-us/library/jj591559.aspx)
2020-07-26 11:30:42 +03:00
* [Event Sourcing pattern](https://docs.microsoft.com/en-us/azure/architecture/patterns/event-sourcing)