Table of Contents

Class GovernanceOutboxDrainWorkerOptions

Namespace
AsiBackbone.AspNetCore.Outbox
Assembly
AsiBackbone.AspNetCore.dll

Provides host-owned scheduling options for the outbox drain worker.

public sealed class GovernanceOutboxDrainWorkerOptions
Inheritance
GovernanceOutboxDrainWorkerOptions
Inherited Members

Remarks

The hosted worker is local to the process in which it is registered. In horizontally scaled deployments, each replica may run its own worker unless the host disables extra replicas, partitions work, or adds durable claiming.

Properties

BatchSize

Gets or sets the maximum number of pending or retry-ready entries attempted per drain pass.

public int BatchSize { get; set; }

Property Value

int

DrainOnShutdown

Gets or sets a value indicating whether a final drain pass should be attempted during host shutdown.

public bool DrainOnShutdown { get; set; }

Property Value

bool

Remarks

Avoid enabling shutdown drains on many replicas against the same durable outbox unless duplicate-emission behavior is controlled through partitioning, durable claiming, or provider-side idempotency.

Enabled

Gets or sets a value indicating whether the hosted drain worker should run.

public bool Enabled { get; set; }

Property Value

bool

Remarks

Runtime changes supplied through IOptionsMonitor pause or resume new drain cycles without restarting the process. A worker that starts disabled validates its scoped drain dependencies once, then remains alive and waits without starting drain cycles or retaining scoped services. Re-enabling normally takes effect immediately through the options change notification, with the configured PollingInterval serving as a fallback observation interval. For multi-replica hosts, enable this only on the selected worker role or partition owner unless the outbox store provides host-owned claim/lease behavior before provider emission.

FailureDelay

Gets or sets the delay after an unexpected worker-level failure before the next drain pass is attempted.

public TimeSpan FailureDelay { get; set; }

Property Value

TimeSpan

PollingInterval

Gets or sets the interval between drain passes when the worker is enabled.

public TimeSpan PollingInterval { get; set; }

Property Value

TimeSpan

Remarks

While the worker is disabled, this interval is also the fallback check period when the configured options source does not raise a change notification.

RetryClock

Gets or sets the retry clock used when finding retry-ready entries.

public Func<DateTimeOffset> RetryClock { get; set; }

Property Value

Func<DateTimeOffset>

Remarks

Prefer registering a TimeProvider instead. While this property keeps its default value, the worker reads the time from the registered TimeProvider, which is the same clock the drain and the signing providers use. Assigning a custom delegate overrides that clock for this worker only.

ShutdownDrainTimeout

Gets or sets the maximum amount of time allowed for an optional shutdown drain pass.

public TimeSpan ShutdownDrainTimeout { get; set; }

Property Value

TimeSpan

Methods

Validate()

Validates the configured worker options.

public void Validate()

Exceptions

InvalidOperationException

Thrown when a required worker option is invalid.