Interface IOutboxRepository
- Namespace
- Stratara.Abstractions.Outbox
- Assembly
- Stratara.Abstractions.dll
Repository over the outbox_entry table — durable queue of messages that
couldn't be published directly to the bus and are retried by the outbox worker.
public interface IOutboxRepository
- Extension Methods
Methods
AddAsync<T>(Guid, T, CancellationToken)
Persist an outbox entry under an identity the caller chose, so the caller can remove it later by that identity. Used by a dispatcher that stores a bundle with the commit and deletes it once the bus has accepted it.
Task AddAsync<T>(Guid id, T outboxData, CancellationToken cancellationToken)
Parameters
idGuidThe identity of the entry.
outboxDataTThe payload.
cancellationTokenCancellationTokenCancels the operation.
Returns
Type Parameters
TThe serialised payload type (command envelope or event bundle).
Exceptions
- NotSupportedException
The repository does not support caller-chosen identities.
AddAsync<T>(T, CancellationToken)
Persist an outbox entry for later delivery.
Task AddAsync<T>(T outboxData, CancellationToken cancellationToken)
Parameters
outboxDataTcancellationTokenCancellationToken
Returns
Type Parameters
TThe serialised payload type (command envelope or event bundle).
DeleteAsync(Guid, CancellationToken)
Remove an entry once it has been published successfully.
Task DeleteAsync(Guid id, CancellationToken cancellationToken)
Parameters
idGuidcancellationTokenCancellationToken
Returns
DeleteManyAsync(IReadOnlyList<Guid>, CancellationToken)
Removes a set of entries in one call.
Task DeleteManyAsync(IReadOnlyList<Guid> ids, CancellationToken cancellationToken)
Parameters
idsIReadOnlyList<Guid>The identities of the entries; an identity that matches no entry is ignored.
cancellationTokenCancellationTokenCancels the operation.
Returns
- Task
A task that completes when every entry is removed.
Remarks
The default removes the entries one at a time through DeleteAsync(Guid, CancellationToken), so an implementation written before this member keeps working unchanged. An implementation backed by a database overrides it with a single statement.
Exceptions
- ArgumentNullException
idsis null.
GetManyAsync<T>(int, CancellationToken)
Return up to batchSizes oldest entries of type T.
Task<IReadOnlyList<OutboxEntry>> GetManyAsync<T>(int batchSizes, CancellationToken cancellationToken)
Parameters
batchSizesintcancellationTokenCancellationToken
Returns
Type Parameters
T