Skip to content

Introduction

NexJob is a reliable, open-source background job processing library for .NET (net8.0 and net10.0). It was built for developers who need jobs that must run, fail safely, and leave a trace — without a paid tier, hidden complexity, or silent failures. NexJob gives you predictable execution, built-in retries, deadline enforcement, dead-letter handling, and a real-time operational dashboard as first-class features from day one.

Why NexJob?

NexJob is for jobs that must run, fail safely and leave a trace.

  • Five storage providers, none behind a paid tier: PostgreSQL, SQL Server, Redis, MongoDB and in-memory, with the same test contract on all of them (how we test).
  • Failure is a first-class case. Deadlines, dead-letter handling, crash recovery and a table of what each failure costs a job are part of the core library.
  • Built-in dashboard and OpenTelemetry, with no extra package to find or license.
  • Near-zero dispatch latency on the node that enqueues, through an in-process wake-up channel.

NexJob is a young library with a focused scope.

Benchmark numbers

Measured per individual enqueue operation with the benchmark in the repository (BenchmarkDotNet 0.15.8, .NET 8.0.31, RyuJIT, in-memory storage), a job with no payload:

Metric NexJob
Latency (mean) 34.5 µs (median 31.7 µs)
Memory allocated 4.82 KB
GC Gen0 (per 1 k ops) 0.12
GC Gen1 (per 1 k ops) 0.00

These are enqueue-only numbers on in-memory storage, not end-to-end throughput. The Hangfire comparison, the other payload sizes and the command to reproduce it are in the FAQ and the README.

Packages

Install only what you need. The core package ships with in-memory storage and the full dispatcher; every other package is optional and adds one capability.

Core

Package What it is
NexJob The library: dispatcher, scheduler, retries, deadlines, in-memory storage and the Roslyn analyzers. Every application needs it.

Storage providers

Pick one. Without any of these, jobs live in memory and are lost when the process stops. See Storage Providers.

Package Backend
NexJob.Postgres PostgreSQL
NexJob.SqlServer SQL Server
NexJob.Redis Redis (also offers opt-in distributed throttle)
NexJob.MongoDB MongoDB

Dashboard

Pick the one that matches your host. See Dashboard.

Package Host
NexJob.Dashboard ASP.NET Core: mounts the dashboard as middleware
NexJob.Dashboard.Standalone Worker Service or console app: runs an embedded HTTP server

Observability

Package What it adds
NexJob.OpenTelemetry Traces and metrics through the OpenTelemetry SDK. See OpenTelemetry.

Triggers and outbox

A trigger turns messages from a broker into jobs. The two outbox packages also publish events from your application in a transaction-safe way. See External Triggers.

Package Broker Trigger Outbox
NexJob.RabbitMQ RabbitMQ yes yes
NexJob.Kafka Apache Kafka yes yes
NexJob.Trigger.AzureServiceBus Azure Service Bus yes
NexJob.Trigger.AwsSqs AWS SQS yes
NexJob.Trigger.GooglePubSub Google Cloud Pub/Sub yes
NexJob.Trigger.Salesforce Salesforce Pub/Sub API (gRPC and Avro) yes
NexJob.Trigger.SalesforceStreaming Salesforce Streaming API (CometD and Bayeux) yes

Key features

Write and run jobs

  • IJob / IJob<T> — clean interfaces for parameterless and typed jobs, with full dependency injection support
  • Job filters — implement IJobExecutionFilter for cross-cutting middleware (logging, correlation IDs, etc.)
  • Job context, progress and checkpoints — report progress, and save a checkpoint so a retried job resumes where it stopped instead of starting over
  • Job continuations — chain jobs with parent/child relationships using ContinueWithAsync
  • Job priority — JobPriority controls execution order within a queue
  • Tags and idempotency keys — label jobs and find them again

Stay reliable

  • Predictable retries — configurable global delay policy plus per-job [Retry] attribute with exponential backoff
  • Failures that should not be retried — list exception types such as ArgumentException and the job goes straight to dead-letter instead of burning attempts
  • Per-job attempt limit — pass maxAttempts when enqueuing, so the same job type can fail fast for one caller and retry longer for another
  • Execution timeout — [ExecutionTimeout] cancels a job's token after a limit and treats it as a normal failure (opt-in, cooperative)
  • Dead-letter handlers and forwarders — an IDeadLetterHandler<T> runs when all retries are exhausted, and an IDeadLetterForwarder sees every such job, which is the hook for alerts
  • Crash recovery — a job left behind by a node that died is found by its stale heartbeat and run again, or dead-lettered if it had no attempts left
  • Deadline enforcement — jobs expire before execution if deadlineAfter has elapsed; no zombie jobs
  • Idempotency — DuplicatePolicy controls re-enqueue behavior for jobs with the same idempotency key
  • Queue isolation by default — the default queue is {prefix}.default per application, so services that share a database do not share a queue; the legacy default is still drained
  • Queue circuit breaker — pauses a queue automatically when a dependency is down, probes it with one job, and ramps back up gradually
  • Concurrency throttling — [Throttle] caps per-resource concurrency locally; AddNexJobDistributedThrottle() enforces cluster-wide limits via Redis
  • Execution windows — restrict a queue to certain hours and days, such as nights only or business days
  • Graceful shutdown — running jobs are given time to finish, and the ones interrupted go back to the queue without using an attempt
  • Delivery guarantees — one table of what each failure costs a job

Schedule

Operate

  • Built-in dashboard — standalone light and dark UI with live cluster topology, SSE log stream, and job catalog
  • Dashboard authorization — implement IDashboardAuthorizationHandler to control who can view or operate the dashboard
  • Runtime control — pause and resume queues, requeue failed jobs, delete jobs and reset circuit breakers at runtime with IJobControlService
  • Alerts — know when a job fails for good, with a Slack recipe and the metrics to alert on
  • Health checks — AddNexJob() on the ASP.NET Core health checks builder reports whether storage is reachable
  • OpenTelemetry — distributed traces and metrics emitted out of the box
  • Job retention — automatic cleanup of terminal jobs with a configurable age per status (RetentionSucceeded, RetentionFailed and the others), and [Retention] to purge or trim a job's payload as soon as it succeeds
  • Configuration — NexJobOptions centralises worker count, polling interval, retry policy, and more

Storage and integrations

Trust

  • Tested on real databases — reliability scenarios with several nodes, a killed process, upgrades from the previous version, and an honest list of what is not covered

Note

NexJob is released under the MIT License and is free for commercial use with no storage-provider paywalls or enterprise tiers. See the LICENSE file for full terms.

Where to go next

  • Quick Start — install NexJob and run your first job in under 5 minutes
  • Mental Model — understand storage-first design, the job state machine, and crash recovery before writing production jobs
  • Migration guide — breaking changes and what to update when you upgrade between NexJob versions