Table of Contents

Class AsiBackboneGovernanceOutboxDrainHostedService

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

Runs the provider-neutral governance outbox drain from an ASP.NET Core or generic-host background worker.

public sealed class AsiBackboneGovernanceOutboxDrainHostedService : BackgroundService, IHostedService, IDisposable
Inheritance
AsiBackboneGovernanceOutboxDrainHostedService
Implements
Inherited Members

Remarks

Hosting remains outside Core. The worker resolves the drain through a scoped service provider so durable providers that depend on scoped infrastructure, such as a host-owned EF Core DbContext, remain safe to use.

Constructors

AsiBackboneGovernanceOutboxDrainHostedService(IServiceScopeFactory, IOptionsMonitor<AsiBackboneGovernanceOutboxDrainWorkerOptions>, ILogger<AsiBackboneGovernanceOutboxDrainHostedService>)

Runs the provider-neutral governance outbox drain from an ASP.NET Core or generic-host background worker.

public AsiBackboneGovernanceOutboxDrainHostedService(IServiceScopeFactory scopeFactory, IOptionsMonitor<AsiBackboneGovernanceOutboxDrainWorkerOptions> optionsMonitor, ILogger<AsiBackboneGovernanceOutboxDrainHostedService> logger)

Parameters

scopeFactory IServiceScopeFactory
optionsMonitor IOptionsMonitor<AsiBackboneGovernanceOutboxDrainWorkerOptions>
logger ILogger<AsiBackboneGovernanceOutboxDrainHostedService>

Remarks

Hosting remains outside Core. The worker resolves the drain through a scoped service provider so durable providers that depend on scoped infrastructure, such as a host-owned EF Core DbContext, remain safe to use.

Methods

ExecuteAsync(CancellationToken)

This method is called when the IHostedService starts. The implementation should return a task that represents the lifetime of the long running operation(s) being performed.

protected override Task ExecuteAsync(CancellationToken stoppingToken)

Parameters

stoppingToken CancellationToken

Triggered when StopAsync(CancellationToken) is called.

Returns

Task

A Task that represents the long running operations.

Remarks

See Worker Services in .NET for implementation guidelines.

StopAsync(CancellationToken)

Triggered when the application host is performing a graceful shutdown.

public override Task StopAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Indicates that the shutdown process should no longer be graceful.

Returns

Task

A Task that represents the asynchronous Stop operation.