Interface IInboxMessage
Represents a message stored in the inbox for idempotent processing and guaranteed delivery. The inbox pattern ensures that each message is processed exactly once, even in the face of failures, network issues, or application restarts.
public interface IInboxMessage
- Extension Methods
Properties
Attempts
Gets or sets the number of processing attempts made for this message. This is incremented each time message processing fails and is used for retry logic and dead letter queue decisions.
int Attempts { get; set; }
Property Value
- int
An integer representing the number of processing attempts, starting from 0.
DispatcherId
Gets or sets the identifier of the dispatcher currently processing this message. This is used to prevent multiple dispatchers from processing the same message concurrently and to track which dispatcher is responsible for processing.
string? DispatcherId { get; set; }
Property Value
- string
A string identifier for the dispatcher, or null if no dispatcher is currently processing this message.
DispatcherTimeout
Gets or sets the timeout timestamp for the current dispatcher processing this message. If the dispatcher does not complete processing before this timeout, the message becomes available for processing by other dispatchers.
DateTimeOffset? DispatcherTimeout { get; set; }
Property Value
- DateTimeOffset?
A DateTimeOffset representing when the current dispatcher's lease expires, or null if no dispatcher is processing.
ExpiresAt
Gets or sets the expiration time for this message. Messages that expire will be automatically cleaned up and will not be processed. A null value indicates the message never expires.
DateTimeOffset? ExpiresAt { get; set; }
Property Value
- DateTimeOffset?
A DateTimeOffset representing when the message expires, or null for no expiration.
ExternalMessageId
Gets the unique identifier for this message from the external source. This ID is provided by the messaging system (e.g., SQS message ID, Service Bus message ID) and is used for correlation and deduplication purposes.
string ExternalMessageId { get; init; }
Property Value
- string
A string representing the external message identifier that must be unique within the message source.
MessageBody
Gets the serialized message payload body. This contains the actual message data that will be deserialized and processed by message handlers. The payload is carried as raw bytes because a configured payload serializer may produce a binary encoding that no text encoding can round-trip without corrupting it.
byte[] MessageBody { get; init; }
Property Value
- byte[]
The raw serialized payload bytes exactly as produced by the configured serializer, or an empty array if the message has no body. When the default JSON serializer is in use these bytes are UTF-8 encoded JSON.
MessageMetadata
Gets the serialized metadata associated with this message. Metadata includes headers, correlation IDs, tracing information, and other message properties that are separate from the actual message payload.
string MessageMetadata { get; init; }
Property Value
- string
A JSON string containing the message metadata, or an empty string if no metadata exists.
MessageType
Gets the name under which the message payload's .NET type is registered, used to resolve the type for deserialization when the entry is drained.
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), so a message type whose simple name is shared with another registered type must be disambiguated by registering only one of them; a qualified name is always unambiguous. 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 this message was first received and stored in the inbox. This is used for ordering, debugging, and message lifecycle management.
DateTimeOffset ReceivedAt { get; init; }
Property Value
- DateTimeOffset
A DateTimeOffset representing when the message was received, in UTC.
TenantId
Gets the tenant identifier this message was received under. Defaults to null so implementations that do not carry tenant scope inherit the default unchanged; a store-backed message surfaces the persisted value so the inbox re-admission drain can re-establish the entry's tenant scope before dispatch, matching the outbox message contract.
string? TenantId { get; }