Table of Contents

Class OutboxDispatcher<TPayload>

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

Pluggable dispatch loop helper for the Transactional Outbox pattern. Combines an IOutboxStore<TPayload> with an IOutboxDispatcher<TPayload> to provide a reusable relay loop.

public sealed class OutboxDispatcher<TPayload>

Type Parameters

TPayload

The outbox message payload type.

Inheritance
OutboxDispatcher<TPayload>
Inherited Members

Constructors

OutboxDispatcher(IOutboxStore<TPayload>, IOutboxDispatcher<TPayload>)

Creates an outbox dispatcher bound to the given store and dispatcher.

public OutboxDispatcher(IOutboxStore<TPayload> store, IOutboxDispatcher<TPayload> dispatcher)

Parameters

store IOutboxStore<TPayload>
dispatcher IOutboxDispatcher<TPayload>

Methods

DrainAsync(CancellationToken)

Drains all pending outbox records by dispatching each through the configured dispatcher. Returns the number of records successfully dispatched.

public ValueTask<int> DrainAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<int>

RunAsync(TimeSpan, CancellationToken)

Continuously drains pending outbox records until cancellationToken is cancelled, waiting pollInterval between each drain cycle.

public ValueTask RunAsync(TimeSpan pollInterval, CancellationToken cancellationToken = default)

Parameters

pollInterval TimeSpan
cancellationToken CancellationToken

Returns

ValueTask