Configure EventData properties
masterAll events in KurrentDB must be wrapped in an EventData object. The core components are:
- eventId: A
Uuidused to uniquely identify the event. If you attempt to append two events with the sameUuidto the same stream in quick succession, KurrentDB will only append the first one. - type: A unique string identifying the event type. It is recommended to use a name that is not strictly tied to a specific code type to facilitate easier versioning later.
- data: The event payload as a byte array. While you can use any format, storing events as JSON objects is recommended to leverage KurrentDB features like projections.
- metadata (optional): A separate byte array for additional context (e.g., correlation IDs, timestamps).
Warning: Metadata must be a valid JSON object using string keys and string values only. Binary metadata is not supported in the current version.
var eventData = new EventData(
Uuid.NewUuid(), // eventId
"OrderPlaced", // type
"{\"orderId\": \"123\"}"u8.ToArray() // data
);