UKBatch.Worker
0.2.2-alpha
dotnet add package UKBatch.Worker --version 0.2.2-alpha
NuGet\Install-Package UKBatch.Worker -Version 0.2.2-alpha
<PackageReference Include="UKBatch.Worker" Version="0.2.2-alpha" />
<PackageVersion Include="UKBatch.Worker" Version="0.2.2-alpha" />
<PackageReference Include="UKBatch.Worker" />
paket add UKBatch.Worker --version 0.2.2-alpha
#r "nuget: UKBatch.Worker, 0.2.2-alpha"
#:package UKBatch.Worker@0.2.2-alpha
#addin nuget:?package=UKBatch.Worker&version=0.2.2-alpha&prerelease
#tool nuget:?package=UKBatch.Worker&version=0.2.2-alpha&prerelease
UKBatch.Worker
Worker-mode helper for UKBatch — a lightweight, pluggable batch/job orchestration library for .NET 8 and .NET 10. One call, b.UseWorkerMode(...), turns a microservice into a worker in a server + workers deployment: it advertises itself to the UKBatch server over an HTTP heartbeat and runs the jobs the orchestrator routes to it over a cross-service transport.
Status: part of the UKBatch 0.1.0-alpha package family.
Install
dotnet add package UKBatch.Worker
Quick start
Register your jobs, opt the host into worker mode, and add a cross-service transport. The worker exposes a health endpoint and stays alive to consume work:
using UKBatch.AspNetCore;
using UKBatch.Transport.RabbitMQ;
using UKBatch.Worker;
var builder = WebApplication.CreateBuilder(args);
builder.AddUKBatchAspNetCore(b =>
{
b.AddJob<GenerateInvoiceJob>().Named("GenerateInvoice");
b.UseWorkerMode(w =>
{
w.WorkerName = "invoicing"; // routing key — see below
w.ServerUrl = "http://ukbatch-server:8080"; // heartbeat target
});
});
// A cross-service transport is REQUIRED in worker mode.
builder.Services.AddUKBatchRabbitMqTransport();
var app = builder.Build();
app.MapHealthChecks("/healthz");
app.Run();
The transport line can equally be builder.Services.AddUKBatchHttpTransport(...); the call order between UseWorkerMode and the transport registration does not matter.
WorkerName is the routing key
WorkerName is not just a label — it is how the orchestrator finds this worker. It MUST match (ordinal, case-sensitive) the name used by .OnService("...") in the server's batch definitions:
// On the server, in a batch definition:
batch.RunJob("GenerateInvoice", step => step.OnService("invoicing"));
A mismatch is silent: the message is routed to a queue nobody consumes, the step never runs, and the worker stays invisible in the dashboard. Match the names exactly.
A cross-service transport is required
Worker mode needs UKBatch.Transport.RabbitMQ or UKBatch.Transport.Http registered. If neither is present, the host fails fast at startup with a clear error rather than starting a worker that can never receive work. The heartbeat alone does not carry dispatch — it is observability only.
WorkerOptions
| Property | Type | Default | Notes |
|---|---|---|---|
WorkerName |
string |
(required) | Logical worker name; the routing key. Must be non-whitespace and match .OnService("..."). |
ServerUrl |
string? |
null |
Base URL the heartbeat POSTs to. Required when Heartbeat is true. |
Tags |
string[]? |
null |
Free-form tags shown in the dashboard Workers panel (observability). |
Heartbeat |
bool |
true |
When false, no heartbeat is sent — the worker is invisible in the dashboard but dispatch still works. |
HeartbeatInterval |
TimeSpan |
15s |
Heartbeat cadence. The server marks a worker offline when no heartbeat arrives for 45 seconds, so keep this comfortably below that. |
ApiKey |
string? |
null |
Reserved for a future release; currently unused. |
When to use it
Use this package only on worker services in a server + workers topology — microservices that execute jobs an external UKBatch server dispatches to them. You do not need it in embedded mode, where the runtime and dashboard live in the same application; there, reference UKBatch.AspNetCore (or UKBatch.Core) directly.
License
MIT. See LICENSE in the repo root. Full docs: nspukcode-hub.github.io/UKBatch · GitHub.
| 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
- Cronos (>= 0.10.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Http (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.0)
- Polly (>= 8.5.0)
- UKBatch.Abstractions (>= 0.2.2-alpha)
- UKBatch.Core (>= 0.2.2-alpha)
-
net8.0
- Cronos (>= 0.10.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Http (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.0)
- Polly (>= 8.5.0)
- UKBatch.Abstractions (>= 0.2.2-alpha)
- UKBatch.Core (>= 0.2.2-alpha)
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 |
|---|---|---|
| 0.2.2-alpha | 58 | 6/18/2026 |
| 0.2.1-alpha | 50 | 6/15/2026 |
| 0.2.0-alpha | 53 | 6/14/2026 |
| 0.1.6-alpha | 64 | 6/13/2026 |
| 0.1.5-alpha | 52 | 6/12/2026 |
| 0.1.4-alpha | 50 | 6/10/2026 |
| 0.1.3-alpha | 56 | 6/8/2026 |
| 0.1.1-alpha | 54 | 6/8/2026 |
| 0.1.0-alpha | 61 | 6/6/2026 |