Table of Contents

Interface IOutboxStore<TPayload>

Namespace
PatternKit.Messaging.Reliability
Assembly
PatternKit.Core.dll

Pluggable backing store for the Transactional Outbox pattern. Implement this interface to provide durable outbox storage (e.g., relational database, file system).

public interface IOutboxStore<TPayload>

Type Parameters

TPayload

The outbox message payload type.

Methods

EnqueueAsync(Message<TPayload>, string?, DateTimeOffset?, CancellationToken)

Adds a message to the outbox and returns the stored record.

ValueTask<OutboxMessage<TPayload>> EnqueueAsync(Message<TPayload> message, string? id = null, DateTimeOffset? createdAt = null, CancellationToken cancellationToken = default)

Parameters

message Message<TPayload>
id string
createdAt DateTimeOffset?
cancellationToken CancellationToken

Returns

ValueTask<OutboxMessage<TPayload>>

MarkDispatchedAsync(string, DateTimeOffset, CancellationToken)

Marks a message as successfully dispatched.

ValueTask MarkDispatchedAsync(string id, DateTimeOffset dispatchedAt, CancellationToken cancellationToken = default)

Parameters

id string
dispatchedAt DateTimeOffset
cancellationToken CancellationToken

Returns

ValueTask

MarkFailedAsync(string, string?, CancellationToken)

Records a failed dispatch attempt for a message.

ValueTask MarkFailedAsync(string id, string? error, CancellationToken cancellationToken = default)

Parameters

id string
error string
cancellationToken CancellationToken

Returns

ValueTask

SnapshotPendingAsync(CancellationToken)

Returns all messages that have not yet been dispatched.

ValueTask<IReadOnlyList<OutboxMessage<TPayload>>> SnapshotPendingAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<IReadOnlyList<OutboxMessage<TPayload>>>