Table of Contents

Class TransportMessage

Namespace
Excalibur.Dispatch.Transport
Assembly
Excalibur.Dispatch.Transport.Abstractions.dll

Represents a message to be sent via a transport. This is the slim replacement for CloudMessage, following the Microsoft.Extensions.AI minimal-type pattern.

public sealed class TransportMessage
Inheritance
TransportMessage
Inherited Members
Extension Methods

Remarks

Transport-specific hints (ordering key, partition key, deduplication ID, scheduled time) flow via Properties with well-known keys from TransportTelemetryConstants.PropertyKeys. Each transport reads these keys and maps them to native SDK concepts.

Properties

Body

Gets or sets the message body content.

public ReadOnlyMemory<byte> Body { get; set; }

Property Value

ReadOnlyMemory<byte>

The message body as a byte buffer.

CausationId

Gets or sets the causation identifier linking this message to its triggering action.

public string? CausationId { get; set; }

Property Value

string

The causation identifier.

ContentType

Gets or sets the content type of the message body (e.g., "application/json").

public string? ContentType { get; set; }

Property Value

string

The MIME content type of the body.

CorrelationId

Gets or sets the correlation identifier for message tracking across services.

public string? CorrelationId { get; set; }

Property Value

string

The correlation identifier.

CreatedAt

Gets or sets the timestamp when the message was created.

public DateTimeOffset CreatedAt { get; set; }

Property Value

DateTimeOffset

The creation timestamp.

HasProperties

Gets a value indicating whether the Properties dictionary has been allocated.

public bool HasProperties { get; }

Property Value

bool

true if properties have been set; otherwise, false.

Id

Gets or sets the unique identifier of the message.

public string Id { get; set; }

Property Value

string

The unique identifier of the message.

MessageType

Gets or sets the message type identifier for routing and processing.

public string? MessageType { get; set; }

Property Value

string

The message type identifier.

Properties

Gets custom message properties/attributes.

public Dictionary<string, object> Properties { get; init; }

Property Value

Dictionary<string, object>

The message properties dictionary.

Remarks

Used by decorators to pass transport-specific hints (ordering key, partition key, etc.) to the underlying transport implementation via well-known keys. The dictionary is lazily initialized on first access to avoid allocation when no properties are set.

Subject

Gets or sets the subject/label of the message.

public string? Subject { get; set; }

Property Value

string

The message subject.

TimeToLive

Gets or sets the time-to-live for the message.

public TimeSpan? TimeToLive { get; set; }

Property Value

TimeSpan?

The time-to-live duration, or null if unlimited.

Methods

FromBytes(byte[])

Creates a new TransportMessage from a byte array body.

public static TransportMessage FromBytes(byte[] body)

Parameters

body byte[]

The message body as a byte array.

Returns

TransportMessage

A new TransportMessage instance.

FromString(string)

Creates a new TransportMessage from a string body using UTF-8 encoding.

public static TransportMessage FromString(string body)

Parameters

body string

The message body as a string.

Returns

TransportMessage

A new TransportMessage instance with content type set to "text/plain".