Table of Contents

Interface IOutboxMessage

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

Represents a message stored in the outbox pattern for guaranteed delivery. The outbox pattern ensures that messages are persisted before being dispatched to prevent message loss in case of system failures.

public interface IOutboxMessage
Extension Methods

Properties

Attempts

Gets or sets the number of delivery attempts made for this message. Used for retry logic and dead letter queue processing.

int Attempts { get; set; }

Property Value

int

The number of delivery attempts made for this message. Used for retry logic and dead letter queue processing.

CreatedAt

Gets the timestamp when the message was created and stored in the outbox.

DateTimeOffset CreatedAt { get; init; }

Property Value

DateTimeOffset

The timestamp when the message was created and stored in the outbox.

Destination

Gets the delivery destination this message is routed to, for round-trip parity on the persisted outbox row. Defaults to null so existing providers that do not yet persist the destination inherit the default unchanged; a provider with a destination column overrides this to surface the stored value. Making destination expressible on the row contract keeps a provider from silently dropping it on the stage-then-reload path.

string? Destination { get; }

Property Value

string

The delivery destination, or null when the store does not carry it.

DispatcherId

Gets or sets the identifier of the dispatcher currently processing this message. Used for distributed processing coordination and preventing duplicate processing.

string? DispatcherId { get; set; }

Property Value

string

The identifier of the dispatcher currently processing this message. Used for distributed processing coordination and preventing duplicate processing.

DispatcherTimeout

Gets or sets the timeout timestamp for the current dispatcher processing this message. If the dispatcher exceeds this timeout, the message can be reassigned to another dispatcher.

DateTimeOffset? DispatcherTimeout { get; set; }

Property Value

DateTimeOffset?

The timeout timestamp for the current dispatcher processing this message. If the dispatcher exceeds this timeout, the message can be reassigned to another dispatcher.

ExpiresAt

Gets or sets the optional expiration timestamp for the message. Messages past their expiration time may be discarded.

DateTimeOffset? ExpiresAt { get; set; }

Property Value

DateTimeOffset?

The optional expiration timestamp for the message. Messages past their expiration time may be discarded.

LastError

Gets the persisted failure information, including pending recovery disposition.

string? LastError { get; init; }

Property Value

string

The last recorded failure, or null before a failure is recorded.

MessageBody

Gets the serialized body content of the message as raw bytes.

byte[] MessageBody { get; init; }

Property Value

byte[]

The serialized body content of the message.

Remarks

The body is stored as byte[] so arbitrary payloads — binary, compressed, or encrypted — round-trip losslessly. A string body would corrupt any non-UTF8 content, matching how first-party message models carry byte bodies (Azure Service Bus ServiceBusMessage.Body, Event Hubs EventData.Body, Kafka payloads).

MessageId

Gets the unique identifier for the message.

string MessageId { get; init; }

Property Value

string

The unique identifier for the message.

MessageMetadata

Gets the metadata associated with the message, such as headers, correlation IDs, and other routing information.

string MessageMetadata { get; init; }

Property Value

string

The metadata associated with the message, such as headers, correlation IDs, and other routing information.

MessageType

Gets the type of the message, typically used for deserialization and routing purposes.

string MessageType { get; init; }

Property Value

string

The type of the message, typically used for deserialization and routing purposes.

Priority

Gets the delivery priority (higher values are dispatched first) on the persisted outbox row. Defaults to 0 so existing providers that do not yet persist a priority inherit the default unchanged; a provider with a priority column overrides this to surface the stored value. Making priority expressible on the row contract keeps a provider from silently dropping it on the stage-then-reload path.

int Priority { get; }

Property Value

int

The delivery priority; 0 when the store does not carry it.

ScheduledAt

Gets the time before which the message must not be delivered, for schedule parity on the persisted outbox row. Defaults to null (immediately deliverable) so existing providers that do not yet persist a schedule inherit the default unchanged; a provider with a scheduled-at column overrides this to surface the stored value. Making the schedule expressible on the row contract keeps a provider from silently treating a future-scheduled message as immediately deliverable after a reload.

DateTimeOffset? ScheduledAt { get; }

Property Value

DateTimeOffset?

The scheduled delivery time, or null when the message is deliverable immediately.

TenantId

Gets the tenant identifier this message was produced under, for multi-tenant scope on the persisted outbox row. Defaults to null so a producer that carries no tenant inherits the default unchanged; an implementation that carries tenant scope overrides this to surface it. Making tenant expressible on the row contract keeps a provider from silently re-dropping it.

string? TenantId { get; }

Property Value

string

The tenant identifier, or null when the producer carries no tenant scope.

Remarks

A null here means "this producer supplied no tenant". It does not survive a store round-trip as a null: a message staged untenanted is drained carrying UntenantedSentinel, because the untenanted partition has exactly one representation on the drain contract. Read the drained value through FromStoredValue(string?) rather than branching on null.