Skip to main content
Table of Contents

Interface IEventBundleOutboxDispatcher

Namespace
Stratara.Abstractions.Outbox
Assembly
Stratara.Abstractions.dll

Enqueues event bundles produced by the event-source on save for projection and saga workers to consume. Implementations first try direct publish and fall back to the outbox table if the bus is unreachable — or, where StoresBundlesWithCommit says so, write the bundle to durable storage in the transaction that commits its events and remove it once the bus has accepted it.

public interface IEventBundleOutboxDispatcher
Extension Methods

Properties

StoresBundlesWithCommit

Whether the event source must hand the bundle to StoreEventBundleAsync(EventBundle, ITransaction, CancellationToken) under the transaction that commits its events, before committing. false by default, which keeps the bus-first path: an implementation that does not override this never sees StoreEventBundleAsync(EventBundle, ITransaction, CancellationToken).

bool StoresBundlesWithCommit { get; }

Property Value

bool

Methods

EnqueueEventBundleAsync(EventBundle, CancellationToken)

Enqueue eventBundle for asynchronous dispatch.

Task EnqueueEventBundleAsync(EventBundle eventBundle, CancellationToken cancellationToken = default)

Parameters

eventBundle EventBundle
cancellationToken CancellationToken

Returns

Task

EnqueueOutboxEntriesAsync(IEnumerable<OutboxEntry>, CancellationToken)

Drain previously-persisted outboxEntries by attempting to publish each one and deleting on success. Used by the outbox worker.

Task EnqueueOutboxEntriesAsync(IEnumerable<OutboxEntry> outboxEntries, CancellationToken cancellationToken = default)

Parameters

outboxEntries IEnumerable<OutboxEntry>
cancellationToken CancellationToken

Returns

Task

StoreEventBundleAsync(EventBundle, ITransaction, CancellationToken)

Writes eventBundle to durable storage under transaction, so that it becomes durable in the same commit as the events it carries. Called by the event source only when StoresBundlesWithCommit is true; the subsequent EnqueueEventBundleAsync(EventBundle, CancellationToken) for the same bundle instance publishes it and removes the stored copy on acceptance.

Task StoreEventBundleAsync(EventBundle eventBundle, ITransaction transaction, CancellationToken cancellationToken = default)

Parameters

eventBundle EventBundle

The bundle the save is about to commit.

transaction ITransaction

The open write transaction the events are staged in.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task

Exceptions

NotSupportedException

The implementation does not store bundles with the commit.