Interface IMultiTransportOutboxStore
Extends IOutboxStore with per-transport delivery tracking for multi-transport scenarios.
public interface IMultiTransportOutboxStore : IOutboxStore, IServiceProvider
- Inherited Members
- Extension Methods
Remarks
When to use: Implement this interface when messages must be delivered to multiple transports independently (e.g., publishing the same order event to both RabbitMQ for internal consumers and Kafka for analytics). If all messages go to a single transport, use IOutboxStore alone.
This interface provides core methods for tracking message delivery to multiple transports independently. When a message needs to be published to multiple transports (e.g., RabbitMQ and Kafka), each transport delivery can be tracked and retried independently.
Implementations should maintain both the aggregate message status and individual transport delivery records. The aggregate status should be updated based on the combined state of all transport deliveries.
This interface contains 5 core methods following the ISP pattern. For administrative and query operations (pending/failed retrieval, statistics, aggregate status), implement IMultiTransportOutboxStoreAdmin. This mirrors the IOutboxStoreAdmin ISP pattern established for IOutboxStore.
Methods
GetTransportDeliveriesAsync(string, string?, CancellationToken)
Retrieves the transport delivery records for a message, confined to the caller's own tenant.
Task<IEnumerable<OutboundMessageTransport>> GetTransportDeliveriesAsync(string messageId, string? tenantId, CancellationToken cancellationToken)
Parameters
messageIdstringThe message ID.
tenantIdstringThe tenant to confine this read to, or null to confine it to the untenanted partition. Trusted as supplied — see the authorization note above.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task<IEnumerable<OutboundMessageTransport>>
Collection of transport delivery records for the message, or an empty collection when the message does not belong to
tenantId's partition.
Remarks
TENANT-CONFINED — the tenant is an explicit argument, never inferred from ambient state. A caller
that supplies its own tenantId together with another tenant's
messageId receives an empty result: the message exists, but not inside the
partition the caller named. Supplying null confines the read to the untenanted
partition (the partition a single-tenant host, or any host that never resolved a tenant for this
operation, operates in).
tenantId is a confinement the caller opts into, not an authorization
boundary the store enforces. This store reads no ambient tenant, so it has nothing to check
tenantId against: it trusts the value supplied and confines the query to it.
A caller that passes a tenant id it is not entitled to receives that tenant's rows, exactly as if it
had called GetAllTenantsTransportDeliveriesAsync(string, CancellationToken)
scoped by hand. Establishing that a caller is actually entitled to the tenant it names is the
caller's own responsibility, at whatever layer resolves the caller's identity.
This is the consumer-facing read. The estate-wide read that spans every tenant — the one the delivery drain needs to make per-transport decisions on messages it claimed across tenants — is a separate, explicitly named operation on the store's administrative surface, not reachable through this method.
Exceptions
- ArgumentException
Thrown when messageId is null or empty.
MarkTransportFailedAsync(string, string, string, CancellationToken)
Marks a specific transport delivery as failed.
Task MarkTransportFailedAsync(string messageId, string transportName, string errorMessage, CancellationToken cancellationToken)
Parameters
messageIdstringThe message ID.
transportNamestringThe transport name.
errorMessagestringThe error description.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task
A task representing the asynchronous operation.
Remarks
This method should update the individual transport delivery record, increment its retry count, and recalculate the aggregate message status based on all transport delivery states.
Exceptions
- ArgumentException
Thrown when messageId or transportName is null or empty.
- ArgumentNullException
Thrown when errorMessage is null.
MarkTransportSentAsync(string, string, CancellationToken)
Marks a specific transport delivery as successfully sent.
Task MarkTransportSentAsync(string messageId, string transportName, CancellationToken cancellationToken)
Parameters
messageIdstringThe message ID.
transportNamestringThe transport name.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task
A task representing the asynchronous operation.
Remarks
This method should update the individual transport delivery record and recalculate the aggregate message status based on all transport delivery states.
Exceptions
- ArgumentException
Thrown when messageId or transportName is null or empty.
MarkTransportSkippedAsync(string, string, string?, CancellationToken)
Marks a specific transport delivery as skipped.
Task MarkTransportSkippedAsync(string messageId, string transportName, string? reason, CancellationToken cancellationToken)
Parameters
messageIdstringThe message ID.
transportNamestringThe transport name.
reasonstringOptional reason for skipping.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task
A task representing the asynchronous operation.
Remarks
A transport delivery may be skipped due to routing rules, transport unavailability, or other configuration-based decisions. Skipped deliveries are considered complete for aggregate status calculation purposes.
Exceptions
- ArgumentException
Thrown when messageId or transportName is null or empty.
StageMessageWithTransportsAsync(OutboundMessage, IEnumerable<OutboundMessageTransport>, CancellationToken)
Stages a message with multiple transport delivery records.
Task StageMessageWithTransportsAsync(OutboundMessage message, IEnumerable<OutboundMessageTransport> transports, CancellationToken cancellationToken)
Parameters
messageOutboundMessageThe outbound message to stage.
transportsIEnumerable<OutboundMessageTransport>The transport delivery records to create.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task
A task representing the asynchronous stage operation.
Exceptions
- ArgumentNullException
Thrown when message or transports is null.