Interface IMultiTransportOutboxStoreAdmin
Provides administrative and query operations for multi-transport outbox store management.
public interface IMultiTransportOutboxStoreAdmin
- Extension Methods
Remarks
These operations are used by background services, health checks, and administrative tooling for managing multi-transport delivery tracking. They are NOT needed for normal message flow (stage/send/fail/skip).
This follows the same ISP pattern as IOutboxStoreAdmin for the base
IOutboxStore. Implementations should access this sub-interface via
GetService(typeof(IMultiTransportOutboxStoreAdmin)) or direct DI registration.
Methods
GetAllTenantsTransportDeliveriesAsync(string, CancellationToken)
Gets the transport delivery records for a message, spanning every tenant.
Task<IEnumerable<OutboundMessageTransport>> GetAllTenantsTransportDeliveriesAsync(string messageId, CancellationToken cancellationToken)
Parameters
messageIdstringThe message ID.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task<IEnumerable<OutboundMessageTransport>>
Collection of transport delivery records for the message, across every tenant.
Remarks
DELIBERATELY ESTATE-WIDE — not tenant-confined, and named explicitly rather than left implicit. The delivery drain claims outbox rows across every tenant by design (one dispatcher serves every tenant, and each claimed row carries its own tenant so the handler re-establishes the owning partition before the message is handled); confining this read to an ambient tenant would return nothing for every tenanted message and stall multi-transport delivery entirely.
Every row this method can return belongs to the one message named by messageId,
and therefore to one tenant — this is not a set that mixes tenants — but the caller receives that
tenant's rows regardless of which tenant, if any, the caller itself is scoped to. Reserved for the
drain and other estate-wide operator paths; a tenant-facing consumer read is
GetTransportDeliveriesAsync(string, string?, CancellationToken).
Exceptions
- ArgumentException
Thrown when messageId is null or empty.
GetFailedTransportDeliveriesAsync(string, int, DateTimeOffset?, int, CancellationToken)
Gets failed transport deliveries that are eligible for retry.
Task<IEnumerable<(OutboundMessage Message, OutboundMessageTransport Transport)>> GetFailedTransportDeliveriesAsync(string transportName, int maxRetries, DateTimeOffset? olderThan, int batchSize, CancellationToken cancellationToken)
Parameters
transportNamestringThe transport name to query.
maxRetriesintMaximum number of retry attempts to consider.
olderThanDateTimeOffset?Only return deliveries that failed before this timestamp.
batchSizeintMaximum number of deliveries to retrieve.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task<IEnumerable<(OutboundMessage Message, OutboundMessageTransport Transport)>>
Collection of failed transport deliveries eligible for retry.
Exceptions
- ArgumentException
Thrown when transportName is null or empty.
GetPendingTransportDeliveriesAsync(string, int, CancellationToken)
Gets pending transport deliveries for a specific transport.
Task<IEnumerable<(OutboundMessage Message, OutboundMessageTransport Transport)>> GetPendingTransportDeliveriesAsync(string transportName, int batchSize, CancellationToken cancellationToken)
Parameters
transportNamestringThe transport name to query.
batchSizeintMaximum number of deliveries to retrieve.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task<IEnumerable<(OutboundMessage Message, OutboundMessageTransport Transport)>>
Collection of pending transport deliveries with their parent messages.
Remarks
This method enables transport-specific workers to retrieve only the messages that need to be delivered to their specific transport, improving efficiency in multi-transport scenarios.
Exceptions
- ArgumentException
Thrown when transportName is null or empty.
GetTransportStatisticsAsync(string?, CancellationToken)
Gets statistics about transport deliveries.
Task<TransportDeliveryStatistics> GetTransportStatisticsAsync(string? transportName, CancellationToken cancellationToken)
Parameters
transportNamestringOptional transport name to filter statistics.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task<TransportDeliveryStatistics>
Transport-specific delivery statistics.
UpdateAggregateStatusAsync(string, CancellationToken)
Updates the aggregate message status based on transport delivery states.
Task UpdateAggregateStatusAsync(string messageId, CancellationToken cancellationToken)
Parameters
messageIdstringThe message ID.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task
A task representing the asynchronous operation.
Remarks
The aggregate status is determined as follows:
- Sent - All transports are Sent or Skipped
- Sending - Any transport is currently Sending
- Failed - All transports have Failed
- PartiallyFailed - Some transports Sent/Skipped, some Failed
- Staged - All transports are still Pending
Exceptions
- ArgumentException
Thrown when messageId is null or empty.