Table of Contents

Class OutboxStoreExtensions

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

Extension methods for IOutboxStore.

public static class OutboxStoreExtensions
Inheritance
OutboxStoreExtensions
Inherited Members

Methods

MarkBatchFailedAsync(IOutboxStore, IReadOnlyList<string>, string, int, string, CancellationToken)

Marks a batch of messages as failed UNDER A CLAIM, reporting per message whether the store applied it.

public static ValueTask<IReadOnlyList<OutboxCompletionOutcome>> MarkBatchFailedAsync(this IOutboxStore store, IReadOnlyList<string> messageIds, string reason, int retryCount, string claimIdentity, CancellationToken cancellationToken)

Parameters

store IOutboxStore

The outbox store. Must expose IClaimScopedOutboxStore.

messageIds IReadOnlyList<string>

The messages to complete.

reason string

The failure reason recorded against each message.

retryCount int

The attempt count recorded against each message.

claimIdentity string

The claim the caller holds and is reporting under.

cancellationToken CancellationToken

A cancellation token.

Returns

ValueTask<IReadOnlyList<OutboxCompletionOutcome>>

One outcome per message id, in the same order. Test for Applied BY NAME; every other value, defined or not, means the store did not apply that message's completion.

Remarks

Prefer this over the unscoped overload whenever the caller holds a claim. The unscoped one completes on MarkFailedAsync(string, string, int, CancellationToken) with no ownership check, so a caller whose claim has lapsed — because its dispatch hung past the reservation window and a later cycle re-claimed the message — has its report accepted anyway, and overwrites a decision it is no longer entitled to make.

It deliberately does NOT take the batch fast path, and that is a capability limit rather than an oversight. MarkBatchFailedAsync(IReadOnlyList<string>, string, int, CancellationToken) returns no value and carries no claim term, so it can neither honour a claim nor report a refusal; routing a claim-scoped completion through it would discard the guarantee this overload exists to provide. Until that member can express an outcome, per-message completion is the only honest implementation, and the cost is stated here rather than hidden.

Outcomes are per message because a lost claim is ROW-scoped. One message being re-claimed says nothing about the others: the caller still owns the rest of the batch and must still complete them. A single aggregate result would force the caller to treat one re-claimed row as a whole-batch failure, which strands messages it still holds.

Exceptions

NotSupportedException

Thrown when store does not expose IClaimScopedOutboxStore. A caller holding a claim cannot be silently served an unscoped completion: that is the defect this overload exists to remove, and returning a success-shaped answer would reintroduce it one layer up.

MarkBatchFailedAsync(IOutboxStore, IReadOnlyList<string>, string, int, CancellationToken)

Marks a batch of messages as failed.

public static ValueTask MarkBatchFailedAsync(this IOutboxStore store, IReadOnlyList<string> messageIds, string reason, int retryCount, CancellationToken cancellationToken)

Parameters

store IOutboxStore
messageIds IReadOnlyList<string>
reason string
retryCount int
cancellationToken CancellationToken

Returns

ValueTask

MarkBatchSentAsync(IOutboxStore, IReadOnlyList<string>, CancellationToken)

Marks a batch of messages as successfully sent.

public static ValueTask MarkBatchSentAsync(this IOutboxStore store, IReadOnlyList<string> messageIds, CancellationToken cancellationToken)

Parameters

store IOutboxStore
messageIds IReadOnlyList<string>
cancellationToken CancellationToken

Returns

ValueTask

TryMarkSentAndReceivedAsync(IOutboxStore, string, InboxEntry, CancellationToken)

Atomically marks message as sent and creates the inbox entry in one transaction, so a redelivery is skipped rather than reprocessed (effectively-once processing; delivery remains at-least-once).

public static ValueTask<bool> TryMarkSentAndReceivedAsync(this IOutboxStore store, string messageId, InboxEntry inboxEntry, CancellationToken cancellationToken)

Parameters

store IOutboxStore
messageId string
inboxEntry InboxEntry
cancellationToken CancellationToken

Returns

ValueTask<bool>