NexJob.Postgres
6.7.0
dotnet add package NexJob.Postgres --version 6.7.0
NuGet\Install-Package NexJob.Postgres -Version 6.7.0
<PackageReference Include="NexJob.Postgres" Version="6.7.0" />
<PackageVersion Include="NexJob.Postgres" Version="6.7.0" />
<PackageReference Include="NexJob.Postgres" />
paket add NexJob.Postgres --version 6.7.0
#r "nuget: NexJob.Postgres, 6.7.0"
#:package NexJob.Postgres@6.7.0
#addin nuget:?package=NexJob.Postgres&version=6.7.0
#tool nuget:?package=NexJob.Postgres&version=6.7.0
NexJob.Postgres
PostgreSQL storage provider for NexJob — the background job scheduler for .NET 8 and .NET 10.
Backed by Npgsql and Dapper, this provider uses SELECT FOR UPDATE SKIP LOCKED for atomic, concurrency-safe job fetching across multiple distributed worker nodes.
Installation
dotnet add package NexJob.Postgres
Quick Start
Register PostgreSQL storage in your dependency injection container before calling AddNexJob():
using NexJob;
using NexJob.Postgres;
var builder = WebApplication.CreateBuilder(args);
// 1. Register PostgreSQL storage
builder.Services.AddNexJobPostgres(
builder.Configuration.GetConnectionString("NexJobConnection")!);
// 2. Register NexJob core services
builder.Services.AddNexJob(options =>
{
options.Workers = 10;
options.QueuePrefix = "myapp"; // the "default" queue below is stored as "myapp.default"
options.Queues = ["default", "critical"];
});
Features
- Atomic Job Dispatching: Fetches with
FOR UPDATE SKIP LOCKED, so server instances do not block each other and a job is never claimed twice. - High-Throughput Batch Processing: Dynamic batch dequeue (
FetchBatchAsync) and vectorized batch acknowledgment (AcknowledgeBatchAsync) with native array operations (WHERE id = ANY(@Ids)). - Automatic Schema Migration: Applies database migrations automatically on startup using PostgreSQL advisory locks (
pg_advisory_lock), ensuring safe concurrent migrations in multi-node clusters. - Idempotency Enforcement: Supports strict and conditional deduplication policies (
DuplicatePolicy) indexed onidempotency_key. - Runtime Settings Store: Persists dynamic queue throttling and runtime configuration in
nexjob_settings. - Dashboard Read Replica Support: Offload read-heavy dashboard and telemetry queries to a secondary database replica.
High-Throughput Batch Processing
For heavy ingestion workloads, enable batch processing to eliminate per-job WAL transaction log flushes:
builder.Services.AddNexJobPostgres(connectionString);
builder.Services.AddNexJob(options =>
{
// Workers dynamically batch fetches to keep all idle slots busy (LIMIT availableWorkers)
options.Workers = 30;
options.PollingInterval = TimeSpan.FromMilliseconds(20);
// Commit successful jobs in asynchronous batches via WHERE id = ANY(@Ids)
options.EnableBatchAcknowledgment = true;
});
Read Replica Configuration
Reusing an NpgsqlDataSource
If your application already has an NpgsqlDataSource (for example one shared with EF Core or configured with custom type mappings), pass it instead of a connection string:
builder.Services.AddNexJobPostgres(existingDataSource);
If your database topology includes a PostgreSQL read replica, you can isolate dashboard queries from the write path using UseDashboardReadReplica:
builder.Services.AddNexJobPostgres(primaryConnectionString);
builder.Services.AddNexJob(options =>
{
options.Workers = 10;
})
.UseDashboardReadReplica(readReplicaConnectionString);
Database Tables
The provider automatically manages the following tables:
| Table | Purpose |
|---|---|
nexjob_jobs |
Job records, payloads, state transitions, attempts, and error logs |
nexjob_recurring |
Recurring cron schedules and execution state |
nexjob_heartbeats |
Active worker node registration and health checks |
nexjob_settings |
Dynamic runtime configurations and queue pause flags |
Connection String Example
{
"ConnectionStrings": {
"NexJobConnection": "Host=localhost;Port=5432;Database=nexjob;Username=postgres;Password=postgres;Include Error Detail=true"
}
}
Connection pool
NexJob shares your database with other applications. A node needs about Workers + 5 connections, so set Maximum Pool Size in the connection string to about Workers + 10 and multiply by the number of nodes. NexJob logs the pool size it finds at startup and warns when it is smaller than Workers. See Database connections and pool sizing.
| 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. |
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 |
|---|---|---|
| 6.7.0 | 77 | 10/19/2026 |
| 6.6.0 | 90 | 10/18/2026 |
| 6.5.1 | 94 | 10/17/2026 |
| 6.5.0 | 111 | 10/17/2026 |
| 6.4.0 | 88 | 10/16/2026 |
| 6.3.0 | 82 | 10/12/2026 |
| 6.2.1 | 88 | 10/11/2026 |
| 6.2.0 | 93 | 10/10/2026 |
| 6.1.0 | 88 | 10/10/2026 |
| 6.0.0 | 99 | 10/9/2026 |
| 5.10.0 | 95 | 10/8/2026 |
| 5.9.0 | 91 | 10/5/2026 |
| 5.8.0 | 105 | 10/4/2026 |
| 5.7.0 | 94 | 10/1/2026 |
| 5.6.2 | 92 | 10/1/2026 |
| 5.6.1 | 90 | 9/30/2026 |
| 5.6.0 | 92 | 9/30/2026 |
| 5.5.0 | 97 | 9/25/2026 |
| 5.4.1 | 92 | 9/24/2026 |
| 5.4.0 | 97 | 9/24/2026 |