Bsft.Hosting.BackgroundWork 2.2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Bsft.Hosting.BackgroundWork --version 2.2.0.1
                    
NuGet\Install-Package Bsft.Hosting.BackgroundWork -Version 2.2.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bsft.Hosting.BackgroundWork" Version="2.2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bsft.Hosting.BackgroundWork" Version="2.2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Bsft.Hosting.BackgroundWork" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bsft.Hosting.BackgroundWork --version 2.2.0.1
                    
#r "nuget: Bsft.Hosting.BackgroundWork, 2.2.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bsft.Hosting.BackgroundWork@2.2.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bsft.Hosting.BackgroundWork&version=2.2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Bsft.Hosting.BackgroundWork&version=2.2.0.1
                    
Install as a Cake Tool

Bsft.Hosting.BackgroundWork

Background work for a generic host, without the web stack: a startup operation that keeps trying until it succeeds, and bounded, never-blocking pipelines that hand items from a hot path to a batching writer. It is what a console tool or a CLI takes when it wants the pipelines and nothing else. Bsft.Hosting references it, so a web host gets the same types from either package.

Install

dotnet add package Bsft.Hosting.BackgroundWork

Depends on Bsft.Instrumentation and on Microsoft.Extensions.Hosting (the generic host, for HostOptions), Microsoft.Extensions.Options, Microsoft.Extensions.Logging.Abstractions, Microsoft.Extensions.DependencyInjection.Abstractions and Microsoft.Extensions.Configuration.Binder. It has no FrameworkReference on Microsoft.AspNetCore.App and no Swashbuckle, Asp.Versioning or OpenAPI package; a test pins that closure.

Register

using Bsft.Hosting.BackgroundWork.DependencyInjection;

services.AddBsftBackgroundWorkRunOnce<RegisterInstanceService>(configuration);

services.AddBsftBatchingWriter<UsageRecord, UsageBatchCommitter>(configuration)
        .AddBsftPipelineEnrichment<UsageRecord, UsageEnricher>(); // optional, after the writer
// producers inject IBoundedBuffer<UsageRecord> (or IEnrichmentStage<UsageRecord>) and call TryEnqueue

The types keep the namespaces they had in Bsft.Hosting (Bsft.Hosting.BackgroundWork, Bsft.Hosting.BackgroundWork.Pipelines). Only the two registration classes moved to Bsft.Hosting.BackgroundWork.DependencyInjection, which is where the package conventions put a package's entry points; a host that used using Bsft.Hosting.DependencyInjection; for these calls adds that one using.

Configure

Option Default Effect
BsftRunOnceOptions (Bsft:Hosting:RunOnce:<service type full name>) see hosting.md The backoff of a run-once startup operation.
BsftBoundedPipelineOptions (Bsft:Hosting:Pipelines:<item type full name>) see hosting.md Capacity, batch size, flush interval and the stop budgets of a pipeline.

Both validate on start; the pipeline's stop budgets must fit in HostOptions.ShutdownTimeout. Counters are read through IPipelineCounters<TItem> and emitted as bsft.pipeline.items on the instrumentation source BackgroundWorkDefaults.PipelineInstrumentationSourceName (Bsft.Hosting, the name they always had).

Extend

IBatchCommitter<TItem> is what a host implements to store a batch; IPipelineEnricher<TItem> is the optional per-item enrichment. RunOnceWithRetryBackgroundServiceBase is the base class of a run-once operation, and IServiceScopeFactory.RunScopedAsync runs one operation against a scoped service and disposes the scope on every path.

Documentation

Topic page: docs/hosting.md. Conventions: docs/package-conventions.md.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bsft.Hosting.BackgroundWork:

Package Downloads
Bsft.Hosting

BSFT Framework hosting defaults for ASP.NET Core: CORS, rate limiting, response compression, JSON, HTTPS redirection, health checks, the exception middleware, host logging and startup validation. No Swashbuckle or API-versioning dependency; OpenAPI, versioning and AddBsftDefaults are in Bsft.Hosting.OpenApi.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.0 92 11/27/2026
2.2.0.1 130 10/31/2026
2.2.0 236 10/23/2026