Skip to main content
Table of Contents

Class EventMessage

Namespace
Stratara.Contracts.Messages
Assembly
Stratara.Contracts.dll

Wire-level representation of a single event that occurred on an aggregate stream. Carries enough metadata for projection / saga workers to reconstruct the event without database access.

[ExcludeFromCodeCoverage]
public sealed record EventMessage : IEquatable<EventMessage>
Inheritance
EventMessage
Implements
Inherited Members
Extension Methods

Remarks

Property names are pinned via JsonPropertyNameAttribute so the wire format is independent of any consumer-side JsonSerializerOptions.PropertyNamingPolicy.

Constructors

EventMessage(Guid, long, string, Guid, string, string, Guid, Guid, Guid, Guid?)

Wire-level representation of a single event that occurred on an aggregate stream. Carries enough metadata for projection / saga workers to reconstruct the event without database access.

public EventMessage(Guid Id, long Version, string DataJson, Guid StreamId, string EventTypeName, string AggregateTypeName, Guid ActorTenantId, Guid ActorUserId, Guid TenantId, Guid? UserId)

Parameters

Id Guid

Event identifier (typically a sortable v7 GUID).

Version long

Aggregate-stream version this event sits at (1-based).

DataJson string

JSON serialization of the event's payload.

StreamId Guid

Identifier of the aggregate stream this event belongs to.

EventTypeName string

Version-independent type name used to resolve the concrete event type.

AggregateTypeName string

Version-independent type name of the aggregate the event was written against.

ActorTenantId Guid

Tenant id of the principal that triggered the write (audit dimension).

ActorUserId Guid

User id of the principal that triggered the write (audit dimension).

TenantId Guid

Tenant the data belongs to (data-owner dimension; used for routing and AAD).

UserId Guid?

Optional user the data belongs to (null for tenant-scoped aggregates).

Remarks

Property names are pinned via JsonPropertyNameAttribute so the wire format is independent of any consumer-side JsonSerializerOptions.PropertyNamingPolicy.

Properties

ActorTenantId

Tenant id of the principal that triggered the write (audit dimension).

[JsonPropertyName("ActorTenantId")]
public Guid ActorTenantId { get; init; }

Property Value

Guid

ActorUserId

User id of the principal that triggered the write (audit dimension).

[JsonPropertyName("ActorUserId")]
public Guid ActorUserId { get; init; }

Property Value

Guid

AggregateTypeName

Version-independent type name of the aggregate the event was written against.

[JsonPropertyName("AggregateTypeName")]
public string AggregateTypeName { get; init; }

Property Value

string

DataJson

JSON serialization of the event's payload.

[JsonPropertyName("DataJson")]
public string DataJson { get; init; }

Property Value

string

EventTypeName

Version-independent type name used to resolve the concrete event type.

[JsonPropertyName("EventTypeName")]
public string EventTypeName { get; init; }

Property Value

string

Id

Event identifier (typically a sortable v7 GUID).

[JsonPropertyName("Id")]
public Guid Id { get; init; }

Property Value

Guid

StreamId

Identifier of the aggregate stream this event belongs to.

[JsonPropertyName("StreamId")]
public Guid StreamId { get; init; }

Property Value

Guid

TenantId

Tenant the data belongs to (data-owner dimension; used for routing and AAD).

[JsonPropertyName("TenantId")]
public Guid TenantId { get; init; }

Property Value

Guid

UserId

Optional user the data belongs to (null for tenant-scoped aggregates).

[JsonPropertyName("UserId")]
public Guid? UserId { get; init; }

Property Value

Guid?

Version

Aggregate-stream version this event sits at (1-based).

[JsonPropertyName("Version")]
public long Version { get; init; }

Property Value

long