Interface IOutboxMaintenance
- Namespace
- Trellis.EntityFrameworkCore
- Assembly
- Trellis.EntityFrameworkCore.Outbox.dll
Operator-facing maintenance for the transactional outbox: inspect dead-lettered (parked) messages and replay them once the cause of their failure has been fixed (for example after deploying the missing handler assembly or correcting a bad payload). Resolve it from a scope — an admin endpoint, a CLI, or a maintenance job — alongside the relay.
public interface IOutboxMaintenance
- Extension Methods
Remarks
This targets the single outbox context registered in the service collection. Registering more than one outbox context in one container is not supported — like OutboxOptions, this facade resolves to the first one registered; run one outbox per composition.
Methods
GetDeadLetteredAsync(int, CancellationToken)
Returns up to limit dead-lettered messages — rows that exhausted
MaxAttempts and are no longer retried — oldest first, for inspection.
Task<IReadOnlyList<OutboxMessage>> GetDeadLetteredAsync(int limit = 100, CancellationToken cancellationToken = default)
Parameters
limitintThe maximum number of rows to return. Must be greater than zero.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
ReplayAllAsync(CancellationToken)
Replays every currently dead-lettered message: resets their attempt counts and clears their leases so the relay drains them again. Returns the number of rows replayed. The set is a snapshot taken when the statement runs — messages that dead-letter after this call are not included.
Task<int> ReplayAllAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
ReplayAsync(Guid, CancellationToken)
Replays a single dead-lettered message by Id: resets its attempt count and clears its lease so the relay drains it again. Returns the number of rows replayed — 0 if the message does not exist or is not dead-lettered, 1 otherwise.
Task<int> ReplayAsync(Guid id, CancellationToken cancellationToken = default)
Parameters
idGuidThe Id of the message to replay.
cancellationTokenCancellationTokenA token to cancel the operation.