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
dispatcherIOutboxDispatcher<TPayload>cancellationTokenCancellationToken
Returns
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
messageMessage<TPayload>idstringcreatedAtDateTimeOffset?cancellationTokenCancellationToken
Returns
- ValueTask<OutboxMessage<TPayload>>