Bsft.Hosting.StartGates
2.3.0
dotnet add package Bsft.Hosting.StartGates --version 2.3.0
NuGet\Install-Package Bsft.Hosting.StartGates -Version 2.3.0
<PackageReference Include="Bsft.Hosting.StartGates" Version="2.3.0" />
<PackageVersion Include="Bsft.Hosting.StartGates" Version="2.3.0" />
<PackageReference Include="Bsft.Hosting.StartGates" />
paket add Bsft.Hosting.StartGates --version 2.3.0
#r "nuget: Bsft.Hosting.StartGates, 2.3.0"
#:package Bsft.Hosting.StartGates@2.3.0
#addin nuget:?package=Bsft.Hosting.StartGates&version=2.3.0
#tool nuget:?package=Bsft.Hosting.StartGates&version=2.3.0
Bsft.Hosting.StartGates
Start gates for hosted background loops: register a precondition once, and every loop registered as gated starts only after it has opened. The loops themselves know nothing about gates.
Install
dotnet add package Bsft.Hosting.StartGates
Requires Bsft.Core (the gate contract) and the generic host's abstractions, and nothing else.
Register a gate
internal sealed class SchemaGate : IHostedWorkStartGate
{
public Task WaitAsync(CancellationToken cancellationToken) => /* completes once the schema is current */;
}
services.AddBsftHostedWorkStartGate<SchemaGate>();
// or, for a gate the host also registers under its own type:
services.AddBsftHostedWorkStartGate(sp => sp.GetRequiredService<SchemaGate>());
Several gates may be registered; a loop waits for all of them, in registration order. A gate that also
implements IHostedWorkStartGateOverdueSignal is what the opt-in hosted-work-start-gates health check of
Bsft.Hosting reports.
Register a loop as gated
services.AddBsftGatedHostedService<MyLoop>();
services.AddBsftGatedHostedService(sp => new MyLoop(sp.GetRequiredService<IWork>()));
The replacement for AddHostedService for a loop that must not run before the host's preconditions hold. The
framework's own dispatchers, sweepers and workers are registered this way. Which gates exist is decided when the
host starts, so the order of the two registrations does not matter.
- With no gate registered the host gets the loop itself: nothing differs from
AddHostedService. - With gates the host gets a wrapper whose start returns at once and which starts the loop after the gates. It is a
BackgroundService, soHostOptions.ServicesStartConcurrentlyandBackgroundServiceExceptionBehaviorapply to it as to any loop; a gate that throws faults it like a loop that fails. - A stop while a gate is pending ends the wrapper cleanly and does not stop the loop, which never started.
Hosted services that react to events or run once at start (subscribers, validators, bootstrappers) stay on
AddHostedService and are never held back.
Documentation
Topic page: docs/hosting.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Bsft.Core (>= 2.3.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.15)
-
net8.0
- Bsft.Core (>= 2.3.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.19)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.19)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.19)
NuGet packages (10)
Showing the top 5 NuGet packages that depend on Bsft.Hosting.StartGates:
| Package | Downloads |
|---|---|
|
Bsft.Retention
BSFT Framework retention: a hosted sweeper that drives one bounded purge pass per set of records a package owns |
|
|
Bsft.EventAggregator.Saga
BSFT Framework saga/flow engine on top of IEventAggregator |
|
|
Bsft.Outbox
BSFT Framework outbox kernel: the drain pass, the retry schedule and the retirement policy every transactional outbox in a host shares, and the optional hosted drain worker. |
|
|
Bsft.Messaging
BSFT Framework messaging: in-memory message bus, integration event staging and the transactional outbox dispatcher. |
|
|
Bsft.Scheduling
BSFT Framework job scheduling: recurring (cron/interval) and delayed background jobs on a leased, durable dispatcher |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.3.0 | 151 | 11/27/2026 |