top of page
Search

Event Sourcing –What, Why and, more importantly, when.

Updated: Dec 1, 2020


ree




What is Event Sourcing (ES)? Event sourcing persists entities such as an Order or a Customer as a sequence of state-changing events. Whenever a business entity changes, new events are appended to the list of events. For some business domains like banking, ES is at the core of its processes. A bank account balance is not a point in time number; it represents the aggregation of financial events such as deposits, withdrawals, fees, and interest over time.


Why?

  • Append only models scale well and are a good fit for Blockchain to support data integrity requirements.

  • Built it Audit. Often applications implement auditing as a business requirement or to support diagnostics.

  • Well constructed events covey intention, not just data.

  • Event replay allows temporal queries to compare various points in time. (What was the account balance at 2:12 pm on November 26, 2019)

  • Natural support for messaged based technologies like message queues and Kafka.


Why not?

  • Raw performance (not scalability) is lower due to the need to serialize/deserialize the events for storage.

  • Managing schema changes over time will require more careful management of the event code.

  • Eventual consistency adds complexity; not a technical nature; those are a solved problem;


When?

  • The application is not trivial. (Offers little business value)

  • The application's expected lifetime is not short and is not proof of concept.

  • The application is not genuinely bound to a need for raw performance.


Brass tacks.

The mantra of YOU MUST USE THIS technology (current/new) is the most destructive anti-pattern in the software space. The proper discovery and selection of technologies can make or break a project before it starts. The hard part of Event Sourcing is defining business entities with clear bounded context and insightful events that support without compromise the business domain and managing consistency. This complexity can sound like a Con but will quickly surface as one of ES's most significant benefits as the application grows in functionality and scalability. In the proper context, ES can provide invaluable flexibility and scalability; however, improperly implemented can quickly become a detriment.


 
 
 

Comments


bottom of page