NexJob.Postgres
5.6.1
See the version list below for details.
dotnet add package NexJob.Postgres --version 5.6.1
NuGet\Install-Package NexJob.Postgres -Version 5.6.1
<PackageReference Include="NexJob.Postgres" Version="5.6.1" />
<PackageVersion Include="NexJob.Postgres" Version="5.6.1" />
<PackageReference Include="NexJob.Postgres" />
paket add NexJob.Postgres --version 5.6.1
#r "nuget: NexJob.Postgres, 5.6.1"
#:package NexJob.Postgres@5.6.1
#addin nuget:?package=NexJob.Postgres&version=5.6.1
#tool nuget:?package=NexJob.Postgres&version=5.6.1
NexJob.Postgres
PostgreSQL storage provider for NexJob — the background job scheduler for .NET 8+.
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.Queues = ["default", "critical"];
});
Features
- Atomic Job Dispatching: Leverages PostgreSQL
FOR UPDATE SKIP LOCKEDto ensure zero lock contention and no double-execution across multiple server instances. - 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"
}
}
| 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 was computed. 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. |
-
net8.0
- Dapper (>= 2.1.35)
- NexJob (>= 5.6.1)
- Npgsql (>= 8.0.5)
- System.Text.Encodings.Web (>= 8.0.0)
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 |
|---|---|---|
| 5.7.0 | 36 | 10/1/2026 |
| 5.6.2 | 41 | 10/1/2026 |
| 5.6.1 | 40 | 9/30/2026 |
| 5.6.0 | 40 | 9/30/2026 |
| 5.5.0 | 84 | 9/25/2026 |
| 5.4.1 | 84 | 9/24/2026 |
| 5.4.0 | 87 | 9/24/2026 |
| 5.3.0 | 90 | 9/21/2026 |
| 5.2.0 | 89 | 9/20/2026 |
| 5.1.0 | 91 | 9/17/2026 |
| 5.0.0 | 101 | 9/17/2026 |
| 4.0.1 | 95 | 9/17/2026 |
| 4.0.0 | 135 | 4/21/2026 |
| 3.0.0 | 126 | 4/16/2026 |
| 2.0.0 | 119 | 4/14/2026 |
| 1.0.0 | 119 | 4/8/2026 |
| 0.8.0 | 127 | 4/8/2026 |
| 0.7.0 | 123 | 4/7/2026 |
| 0.6.0 | 117 | 4/3/2026 |
| 0.0.0-alpha.0 | 49 | 9/17/2026 |