Interface ITransportMessageMetadata
Represents metadata associated with a message for serialization and transport.
public interface ITransportMessageMetadata
- Extension Methods
Remarks
This interface defines the standard metadata properties that flow with messages across service boundaries. Implementations typically serialize this metadata as message headers or properties in the underlying transport mechanism. All properties use init-only setters to ensure immutability after creation.
Properties
CausationId
Gets the identifier of the message that caused this message to be created.
string? CausationId { get; init; }
Property Value
Remarks
Forms a causality chain for debugging. May be null for root messages that were not caused by another message.
ContentType
Gets the MIME type of the message payload serialization format.
string ContentType { get; init; }
Property Value
- string
The payload MIME type.
Remarks
Common values include "application/json", "application/x-msgpack", or "application/octet-stream". Used to select the appropriate deserializer.
ContractVersion
Gets the overall API contract version this message adheres to.
string ContractVersion { get; init; }
Property Value
- string
The API contract version.
Remarks
Represents a higher-level versioning scheme that may encompass multiple message versions within a service or bounded context.
CorrelationId
Gets the correlation identifier that groups related messages together.
string CorrelationId { get; init; }
Property Value
- string
The unique correlation identifier.
Remarks
This ID flows through all messages in a business transaction or workflow, enabling end-to-end tracing across service boundaries.
MessageVersion
Gets the schema version of the message payload structure.
string MessageVersion { get; init; }
Property Value
- string
The payload schema version.
Remarks
Indicates the version of the message contract. Used by versioning middleware to apply migrations between versions.
SerializerVersion
Gets the version of the serializer used to encode the message.
string SerializerVersion { get; init; }
Property Value
- string
The serializer version.
Remarks
Enables backward compatibility when serialization libraries are upgraded. Format is typically "major.minor" (e.g., "1.0", "2.1").
TenantId
Gets the tenant identifier for multi-tenant message routing and isolation.
string? TenantId { get; init; }
Property Value
Remarks
Used to ensure messages are processed in the correct tenant context and to enforce data isolation in multi-tenant systems.
TraceParent
Gets the W3C trace context header for distributed tracing integration.
string? TraceParent { get; init; }
Property Value
Remarks
Contains trace-id and span-id in W3C format. Integrates with OpenTelemetry and other distributed tracing systems for observability.
UserId
Gets the identifier of the user who initiated this message.
string? UserId { get; init; }
Property Value
Remarks
Used for audit trails and authorization. May be null for system-initiated messages or anonymous operations.