AshEvents is an extension for the Ash Framework that brings first-class event sourcing capabilities to your applications. It simplifies the process of tracking and replaying events, making it easier to manage historical data and debug complex systems.
Why AshEvents?
State handling in applications
Due to a myriad of reasons, most applications built today only keep track of the current state of their data. Two main reasons for this are:
- Databases were designed back when computers had extreme resource constraints compared to today's standards, and storing historical data was not feasible without paying an extreme cost. Even though this is no longer the case, the practices established at that time still persist.
- Building a system that is able to preserve and utilise historical data is both complex and time-consuming compared to just building a traditional CRUD-application. Unless it is a hard requirement, it often doesn't pass the cost/benefit trade-off when you want your app to be up and running yesterday.
If you never have any use for looking at historical data, then all of this is fine and you can carry on without any worries.
Unfortunately, this is usually not the case. Seasoned developers today will tell you it is crazy to develop a codebase without using Git or any other version control system, and an accountant will always record every transaction instead of just updating the current balances.
These practices reflect the idea that a domain's state is a growing set of events, with the current state derived by applying these events in order. If you want to know how you got where you are, you need to keep track of the steps you have made on your journey.
Odds are that there will be some varying degree of business value in treating your application data in the same manner.
What AshEvents brings to the table
In the Ash ecosystem, we already have the AshPaperTrail-extension to help with auditing. This provides a simple way to track changes to your data. However,
AshPaperTrail
only tracks changes to individual records. This can lead to complex debugging scenarios if you need to look at multiple versions of records, across several resources, to figure out what happened and why.AshEvents provides a centralised event log that records all events for your application. In addition to making system-wide auditing straightforward, the extension also provides these features:
- Event Versioning: Track schema evolution by versioning events.
- Actor Attribution: Identify who performed each action.
- Event Replay: Rebuild application state by replaying events, up to a specific point in time or event.
- Version-Specific Replay Routing: Route events to different actions based on their version, even to multiple resource actions if needed due to application refactors.
- Customisable Metadata: Attach arbitrary metadata to events for richer context.
continue reading on alembic.com.au
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.