Skip to content
Duncan Jones edited this page Sep 13, 2019 · 3 revisions

Events

An event is a specific thing that has occurred in the past to an individual entity. It has an unique event type name which should be a past tense form.

Events only get added to the end of the event stream (you can conceptualise this as a stack that doesn't have a pop option)

Events are stored by the thing they occur to, rather than the type of event that the are. For example we don't have a separate table for "payments" and "standing orders" in a bank account type of system - these are just different events that occur in the life of the bank account.

Events cannot be deleted nor can their content be modified - if you need to "undo" something that has happened a reversal or undo event needs to be added to the event store

Implementation

Append Blob

Events are appended to the specific blob for the entity to which the event pertains, serialised as JSON. The business data of the event is wrapped in an event context that adds the event type name, sequence number and other context properties.

##Table (NoSQL)

In the Azure Table implementation the domain is used to navigate to the storage account that holds the table, the entity type is used to get the table name and the entity instance identifier is used as the partition key field for each row of the table. The second part of the key - the row key field - is the event sequence number (0 padded) and the event details are held in the non key fields of the record.

There are special fields (e.g. EventType ) for the event context information.

The record with a row key of 0000000000 is the information record that holds the current sequence number and context information for the whole event stream for the instance unique identifier. Access to this record enforces concurrency checking.

Clone this wiki locally