SimpleW.Service.Background
26.0.0-alpha.20260428-1831
dotnet add package SimpleW.Service.Background --version 26.0.0-alpha.20260428-1831
NuGet\Install-Package SimpleW.Service.Background -Version 26.0.0-alpha.20260428-1831
<PackageReference Include="SimpleW.Service.Background" Version="26.0.0-alpha.20260428-1831" />
<PackageVersion Include="SimpleW.Service.Background" Version="26.0.0-alpha.20260428-1831" />
<PackageReference Include="SimpleW.Service.Background" />
paket add SimpleW.Service.Background --version 26.0.0-alpha.20260428-1831
#r "nuget: SimpleW.Service.Background, 26.0.0-alpha.20260428-1831"
#:package SimpleW.Service.Background@26.0.0-alpha.20260428-1831
#addin nuget:?package=SimpleW.Service.Background&version=26.0.0-alpha.20260428-1831&prerelease
#tool nuget:?package=SimpleW.Service.Background&version=26.0.0-alpha.20260428-1831&prerelease
SimpleW.Service.Background
In-process background jobs and cron scheduling for SimpleW.
Getting Started
using SimpleW;
using SimpleW.Service.Background;
var server = new SimpleWServer(System.Net.IPAddress.Any, 8080);
server.UseBackgroundModule(options => {
options.WorkerCount = 2;
options.JobStore = new MemoryBackgroundJobStore();
options.Schedule("cleanup", "0 2 * * *", async ctx => {
await CleanupAsync(ctx.CancellationToken);
});
});
server.MapPost("/import", (HttpSession session) => {
string payload = session.Request.BodyString;
BackgroundJobHandle job = session.GetBackgroundService().Enqueue("import", async ctx => {
ctx.ReportProgress(0, "Starting import");
await ImportAsync(payload, ctx.CancellationToken);
ctx.ReportProgress(100, "Done");
});
return session.Response.Status(202).Json(new {
accepted = true,
jobId = job.Id
});
});
await server.RunAsync();
Jobs are kept in memory only. They do not survive process restart.
Use ctx.ReportProgress(percent, message) from inside a job to update the latest progress exposed by GetJob(jobId).
Telemetry is optional and follows the SimpleW telemetry switch:
server.EnableTelemetry();
server.UseBackgroundModule(options => {
options.EnableTelemetry = true;
});
When enabled, the module emits low-cardinality counters and gauges such as simplew.background.job.enqueued.count, simplew.background.job.completed.count, simplew.background.queue.length, and simplew.background.job.running.
Metrics are tagged only with stable values like source, result, and reason. Job ids, job names, cron expressions, and progress messages are not used as metric tags.
Use options.JobStore with a custom IBackgroundJobStore to persist job snapshots in another backend. The current module still executes in-process delegates; durable replay after restart will need a future typed-job/payload model.
| 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 is compatible. 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. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.0.0-alpha.20260428-1831 | 51 | 4/28/2026 |
| 26.0.0-alpha.20260427-1828 | 56 | 4/27/2026 |
