Table of Contents

Class InboxMessage

Namespace
Excalibur.Dispatch.Delivery
Assembly
Excalibur.Outbox.dll

Represents a message stored in the inbox pattern for reliable message processing.

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.PublicProperties)]
public sealed record InboxMessage : IInboxMessage, IEquatable<InboxMessage>
Inheritance
InboxMessage
Implements
Inherited Members

Constructors

InboxMessage()

Initializes a new instance of the InboxMessage class.

public InboxMessage()

InboxMessage(string, string, string, byte[], DateTimeOffset)

Initializes a new instance of the InboxMessage class with required properties.

[SetsRequiredMembers]
public InboxMessage(string externalMessageId, string messageType, string messageMetadata, byte[] messageBody, DateTimeOffset receivedAt)

Parameters

externalMessageId string

The external identifier for the message.

messageType string

The type of the message.

messageMetadata string

The serialized message metadata.

messageBody byte[]

The serialized message body bytes.

receivedAt DateTimeOffset

The timestamp when the message was received.

InboxMessage(string, string, string, byte[], DateTimeOffset, int, string?, DateTimeOffset?)

Initializes a new instance of the InboxMessage class with processing tracking.

[SetsRequiredMembers]
public InboxMessage(string externalMessageId, string messageType, string messageMetadata, byte[] messageBody, DateTimeOffset receivedAt, int attempts, string? dispatcherId, DateTimeOffset? dispatcherTimeout)

Parameters

externalMessageId string

The external identifier for the message.

messageType string

The type of the message.

messageMetadata string

The serialized message metadata.

messageBody byte[]

The serialized message body bytes.

receivedAt DateTimeOffset

The timestamp when the message was received.

attempts int

The number of processing attempts.

dispatcherId string

The optional identifier of the processor handling this message.

dispatcherTimeout DateTimeOffset?

The optional timeout for the processor.

InboxMessage(string, string, string, byte[], DateTimeOffset, DateTimeOffset?)

Initializes a new instance of the InboxMessage class with expiration.

[SetsRequiredMembers]
public InboxMessage(string externalMessageId, string messageType, string messageMetadata, byte[] messageBody, DateTimeOffset receivedAt, DateTimeOffset? expiresAt)

Parameters

externalMessageId string

The external identifier for the message.

messageType string

The type of the message.

messageMetadata string

The serialized message metadata.

messageBody byte[]

The serialized message body bytes.

receivedAt DateTimeOffset

The timestamp when the message was received.

expiresAt DateTimeOffset?

The optional expiration timestamp for the message.

Properties

Attempts

Gets or sets the number of processing attempts made for this message.

public int Attempts { get; set; }

Property Value

int

The current Attempts value.

DispatcherId

Gets or sets the optional identifier of the processor handling this message.

public string? DispatcherId { get; set; }

Property Value

string

The current DispatcherId value.

DispatcherTimeout

Gets or sets the optional timeout for the processor.

public DateTimeOffset? DispatcherTimeout { get; set; }

Property Value

DateTimeOffset?

The current DispatcherTimeout value.

ExpiresAt

Gets or sets the optional expiration timestamp for the message.

public DateTimeOffset? ExpiresAt { get; set; }

Property Value

DateTimeOffset?

The current ExpiresAt value.

ExternalMessageId

Gets the external identifier for the message from the source system.

public required string ExternalMessageId { get; init; }

Property Value

string

The current ExternalMessageId value.

MessageBody

Gets the serialized message body bytes, exactly as produced by the configured serializer.

public required byte[] MessageBody { get; init; }

Property Value

byte[]

The current MessageBody value.

MessageMetadata

Gets the serialized message metadata.

public required string MessageMetadata { get; init; }

Property Value

string

The current MessageMetadata value.

MessageType

Gets the name under which the message's .NET type is registered.

public required string MessageType { get; init; }

Property Value

string

A type name the message type registry can resolve. The framework's own inbox writers store the simple name (Type.Name). An ambiguous simple name — one shared by two registered types — resolves to nothing rather than to either of them, so a collision fails loudly at resolution rather than deserializing the payload as the wrong type.

ReceivedAt

Gets the timestamp when the message was received.

public required DateTimeOffset ReceivedAt { get; init; }

Property Value

DateTimeOffset

The current ReceivedAt value.

TenantId

Gets the tenant identifier this message was received under, or null when no tenant scope is carried. Populated from the persisted inbox entry so the re-admission drain re-establishes the entry's tenant scope before dispatch.

public string? TenantId { get; init; }

Property Value

string

The current TenantId value.

Methods

Equals(InboxMessage?)

Determines whether the specified InboxMessage is equal to the current instance, comparing MessageBody by content rather than by reference.

public bool Equals(InboxMessage? other)

Parameters

other InboxMessage

The other message to compare against.

Returns

bool

true if the messages are equal; otherwise false.

Remarks

The compiler-synthesized record equality compares the MessageBody byte array by reference, which would make two records carrying identical payloads unequal. This override restores value semantics by comparing the payload bytes structurally, keeping the record's value-equality contract intact for a binary body.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.