UKBatch.Worker 0.2.2-alpha

This is a prerelease version of UKBatch.Worker.
dotnet add package UKBatch.Worker --version 0.2.2-alpha
                    
NuGet\Install-Package UKBatch.Worker -Version 0.2.2-alpha
                    
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="UKBatch.Worker" Version="0.2.2-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UKBatch.Worker" Version="0.2.2-alpha" />
                    
Directory.Packages.props
<PackageReference Include="UKBatch.Worker" />
                    
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 UKBatch.Worker --version 0.2.2-alpha
                    
#r "nuget: UKBatch.Worker, 0.2.2-alpha"
                    
#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 UKBatch.Worker@0.2.2-alpha
                    
#: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=UKBatch.Worker&version=0.2.2-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=UKBatch.Worker&version=0.2.2-alpha&prerelease
                    
Install as a Cake Tool

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 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

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