WJb 1.0.0-beta1

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

📘 WJb — Lightweight Priority Job Runner for .NET

Nuget Donate

🚀 What is WJb?

WJb is a lightweight, priority‑aware, workflow‑capable background job runner for .NET. It focuses on simplicity, predictability, testability, and full control — without forcing EF Core, hosted queues, or external services.


⭐ Features

  • In‑memory priority queue (ASAP / High / Normal / Low) with backpressure, fairness & in‑flight limits
  • Parallel job processing (MaxParallelJobs)
  • DI-friendly Actions (IAction / IActionFactory)
  • Workflow chaining (success → next, failure → fail)
  • Cron‑based scheduling (JobScheduler)
  • JSON-based job payloads
  • Built‑in Telemetry — Metrics + Activity tracing

📦 Install

dotnet add package WJb

🛠️ Register in Program.cs

services.AddWJbActions(map =>
{
    map["Email"] = new ActionItem(
        type: typeof(EmailAction).AssemblyQualifiedName!,
        more: new JsonObject());
});

services.AddWJbBase(opts =>
{
    opts["MaxParallelJobs"] = 4;
});

📨 Enqueue a Job

await processor.EnqueueJobAsync(
    await processor.CompactAsync("Email", new { to = "user@example.com" }),
    Priority.High);

🔁 Workflow Chaining

WJb supports deterministic branching using next_* and fail_* keys.

{
  "Start": {
    "type": "WorkflowAction",
    "more": {
      "next": "SendEmail",
      "next_to": "user@example.com",
      "fail": "LogError",
      "fail_message": "Startup failed"
    }
  },
  "SendEmail": {
    "type": "EmailAction",
    "more": {
      "from": "noreply@example.com",
      "subject": "Welcome!"
    }
  },
  "LogError": {
    "type": "LogAction",
    "more": { "level": "Error" }
  }
}

Rules

  • Only next_* / fail_* keys are forwarded
  • Prefix removed → merged into next action
  • Child‑wins merge (job overrides action defaults)
  • Priority may be overridden using:
    • next_priority
    • fail_priority

Telemetry & Metrics (since 0.23+)

WJb now includes first‑class Telemetry:

✔ Metrics via System.Diagnostics.Metrics

Built‑in instruments:

Counters

  • jobs_queued
  • jobs_compacted
  • jobs_expanded
  • jobs_started
  • jobs_completed
  • jobs_failed

Histograms

  • job_duration_ms (per job execution)

Every measurement includes rich tags (e.g., action_type, priority, reason, outcome).

Example Setup

var meter = new Meter("WJb.JobProcessor", "1.0.0");
services.Configure<WJbTelemetryOptions>(opts =>
{
    opts.OnJobCompleted = evt => Console.WriteLine($"Job completed: {evt.ActionName}");
});

🧭 Activity Tracing (OpenTelemetry‑friendly)

WJb emits:

  • WJb.Job — per-job execution activity
  • WJb.JobEnqueued — enqueue events

Tags include:

  • actionName
  • priority
  • attempt
  • durationMs

Works with:

  • OpenTelemetry Collector
  • Azure Application Insights
  • Jaeger / Zipkin
  • Grafana Tempo

⏳ Priority Queue

The in‑memory queue includes:

Backpressure

Blocking writers when per‑priority queues are full.

Per‑priority concurrency limits

MaxInFlightASAP, MaxInFlightHigh, MaxInFlightNormal, MaxInFlightLow

Fairness

Weighted round‑robin:

  • WeightASAP
  • WeightHigh
  • WeightNormal
  • WeightLow

Ensures:

  • High responsiveness for ASAP/High
  • Guaranteed progress for Normal/Low

🏷 License

MIT License (see LICENSE file)


🙌 Support

If WJb helps you — ⭐ the repo or support via PayPal.

Product Compatible and additional computed target framework versions.
.NET 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
1.0.0-beta1 1,010 1/14/2026
0.25.0-beta 1,979 1/12/2026