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
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
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
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
PollingInterval
Gets or sets the interval between drain passes when the worker is enabled.
public TimeSpan PollingInterval { get; set; }
Property Value
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
Obsolete. Gets or sets the legacy clock used to timestamp a hosted drain cycle.
[Obsolete("RetryClock bypasses the registered TimeProvider for the entire hosted drain cycle and can diverge from other TimeProvider consumers. Register a TimeProvider instead. Planned removal in 8.0.", DiagnosticId = "ASIB903", UrlFormat = "https://asibackbone.github.io/AsiBackbone/articles/asib903-outbox-retry-clock.html")]
public Func<DateTimeOffset> RetryClock { get; set; }
Property Value
Remarks
Register a TimeProvider instead. While this property keeps its default value, the worker reads the registered provider and passes that timestamp to the drain. Assigning a custom delegate instead supplies the explicit timestamp for the whole drain cycle, including retry-ready checks, claim timing, and persisted drain transitions. Other TimeProvider consumers continue to read the registered provider and can therefore disagree with the custom delegate. The warning remains non-error in the 7.x line; removal is planned for the next permitted major version.
ShutdownDrainTimeout
Gets or sets the maximum amount of time allowed for an optional shutdown drain pass.
public TimeSpan ShutdownDrainTimeout { get; set; }
Property Value
Methods
Validate()
Validates the configured worker options.
public void Validate()
Exceptions
- InvalidOperationException
Thrown when a required worker option is invalid.