Class MessageMetadata
Default implementation of message metadata containing essential message properties.
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.PublicProperties)]
public record MessageMetadata : ITransportMessageMetadata, IEquatable<MessageMetadata>
- Inheritance
-
MessageMetadata
- Implements
- Inherited Members
- Extension Methods
Remarks
This record contains metadata that travels with messages through the dispatch pipeline, including correlation information, versioning, and tenant/user context.
Constructors
MessageMetadata(string, string, string?, string?, string?, string?, string, string, string, string)
Default implementation of message metadata containing essential message properties.
public MessageMetadata(string MessageId, string CorrelationId, string? CausationId, string? TraceParent, string? TenantId, string? UserId, string ContentType, string SerializerVersion, string MessageVersion, string ContractVersion = "1.0.0")
Parameters
MessageIdstringUnique identifier for the message.
CorrelationIdstringUnique identifier for tracking related messages.
CausationIdstringIdentifier of the message that caused this message.
TraceParentstringW3C trace context for distributed tracing.
TenantIdstringTenant identifier for multi-tenant scenarios.
UserIdstringUser identifier associated with the message.
ContentTypestringMIME type of the message content.
SerializerVersionstringVersion of the serializer used.
MessageVersionstringVersion of the message format.
ContractVersionstringVersion of the message contract (defaults to "1.0.0").
Remarks
This record contains metadata that travels with messages through the dispatch pipeline, including correlation information, versioning, and tenant/user context.
Properties
CausationId
Identifier of the message that caused this message.
public string? CausationId { get; init; }
Property Value
ContentType
MIME type of the message content.
public string ContentType { get; init; }
Property Value
ContractVersion
Version of the message contract (defaults to "1.0.0").
public string ContractVersion { get; init; }
Property Value
CorrelationId
Unique identifier for tracking related messages.
public string CorrelationId { get; init; }
Property Value
MessageId
Unique identifier for the message.
public string MessageId { get; init; }
Property Value
MessageVersion
Version of the message format.
public string MessageVersion { get; init; }
Property Value
SerializerVersion
Version of the serializer used.
public string SerializerVersion { get; init; }
Property Value
TenantId
Tenant identifier for multi-tenant scenarios.
public string? TenantId { get; init; }
Property Value
TraceParent
W3C trace context for distributed tracing.
public string? TraceParent { get; init; }
Property Value
UserId
User identifier associated with the message.
public string? UserId { get; init; }
Property Value
Methods
FromContext(IMessageContext)
Creates a MessageMetadata instance from a message context.
public static MessageMetadata FromContext(IMessageContext context)
Parameters
contextIMessageContextThe message context.
Returns
- MessageMetadata
A new MessageMetadata instance.