pawelgorka
9/22/2017 - 5:57 PM

event sourcing materials

all kinds of usefull event sourcing materials

Event Structure

[
  {
    "eventId": "fbf4a1a1-b4a3-4dfe-a01f-ec52c34e16e4",
    "eventType": "event-type",
    "data": {

      "a": "1"
    }
  }
]

publish this event to event store:

curl -i -d @event.txt "http://127.0.0.1:2113/streams/newstream" -H "Content-Type:application/vnd.eventstore.events+json"

fields to remember to add to an event:


AggregateId – This field is used to associate the particular event to a specific aggregate root.
Date Time Stamp – Ordering of events is crucial. Replaying events in the wrong order can result is unpredictable outcomes.
UserId – This field is commonly required in a line of business applications and can be used to build audit logs. It is a common field, but not always necessary and depends on the specific domain.
Version – The version number allows the developer to handle concurrency conflicts and partial connection scenarios. For more information, take a look at Handling Concurrency Issues in a CQRS Event Sourced system.
ProcessId – At its simplest, this field can be used to tie a series of events back to their originating command. However, it can also be used to ensure the idempotence* of the event.