Table of Contents

Class InMemoryOutbox<TPayload>

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

Thread-safe in-memory outbox for tests, demos, and single-process applications.

public sealed class InMemoryOutbox<TPayload>

Type Parameters

TPayload
Inheritance
InMemoryOutbox<TPayload>
Inherited Members

Properties

Records

The current outbox records.

public IReadOnlyList<OutboxMessage<TPayload>> Records { get; }

Property Value

IReadOnlyList<OutboxMessage<TPayload>>

Methods

DispatchPendingAsync(IOutboxDispatcher<TPayload>, CancellationToken)

Dispatches pending records through dispatcher.

public ValueTask<int> DispatchPendingAsync(IOutboxDispatcher<TPayload> dispatcher, CancellationToken cancellationToken = default)

Parameters

dispatcher IOutboxDispatcher<TPayload>
cancellationToken CancellationToken

Returns

ValueTask<int>

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

Adds a message to the outbox.

public 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>>