NexJob.SqlServer
6.2.0
See the version list below for details.
dotnet add package NexJob.SqlServer --version 6.2.0
NuGet\Install-Package NexJob.SqlServer -Version 6.2.0
<PackageReference Include="NexJob.SqlServer" Version="6.2.0" />
<PackageVersion Include="NexJob.SqlServer" Version="6.2.0" />
<PackageReference Include="NexJob.SqlServer" />
paket add NexJob.SqlServer --version 6.2.0
#r "nuget: NexJob.SqlServer, 6.2.0"
#:package NexJob.SqlServer@6.2.0
#addin nuget:?package=NexJob.SqlServer&version=6.2.0
#tool nuget:?package=NexJob.SqlServer&version=6.2.0
NexJob.SqlServer
Microsoft SQL Server storage provider for NexJob — the background job scheduler for .NET 8+.
Backed by Microsoft.Data.SqlClient and Dapper, this provider uses WITH (UPDLOCK, READPAST, ROWLOCK) hints for atomic, lock-contention-free job fetching across multiple distributed worker nodes.
Installation
dotnet add package NexJob.SqlServer
Quick Start
Register SQL Server storage in your dependency injection container before calling AddNexJob():
using NexJob;
using NexJob.SqlServer;
var builder = WebApplication.CreateBuilder(args);
// 1. Register SQL Server storage
builder.Services.AddNexJobSqlServer(
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: Employs
WITH (UPDLOCK, READPAST, ROWLOCK)locking hints to allow multiple workers to concurrently dequeue jobs without blocking each other or causing deadlocks. - High-Throughput Batch Processing: Dynamic batch dequeue (
FetchBatchAsync) based on worker idle slots and vectorized batch acknowledgment (AcknowledgeBatchAsync). - Non-blocking Scheduled Promotion: Guarded with
sp_getapplockandREADPASTto eliminate deadlock 1205 contention under high concurrency. - Automatic Schema Migration: Applies database schema migrations automatically on startup using
sp_getapplock, guaranteeing safe concurrent execution in clustered environments. - Idempotency Enforcement: Enforces strict and conditional deduplication policies (
DuplicatePolicy) indexed onidempotency_key. - Runtime Settings Store: Persists queue concurrency rules and runtime settings in
nexjob_settings. - Dashboard Read Replica Support: Route dashboard metrics and monitoring queries to an Azure SQL / SQL Server read-scale replica.
High-Throughput Batch Processing
For heavy ingestion workloads (e.g. streaming hundreds of thousands of events from Kafka/RabbitMQ into SQL Server), enable batch processing:
builder.Services.AddNexJobSqlServer(connectionString);
builder.Services.AddNexJob(options =>
{
// Workers fetch jobs in atomic batches up to current idle capacity (TOP availableWorkers)
options.Workers = 30;
options.PollingInterval = TimeSpan.FromMilliseconds(20);
// Commit successful jobs in asynchronous batches, eliminating per-job write roundtrips
options.EnableBatchAcknowledgment = true;
});
Read Replica Configuration
To offload dashboard queries to a read replica (such as Azure SQL Database Read-Scale Out or Always On Availability Groups):
builder.Services.AddNexJobSqlServer(primaryConnectionString);
builder.Services.AddNexJob(options =>
{
options.Workers = 10;
})
.UseDashboardReadReplica(readReplicaConnectionString);
Database Tables
The provider automatically manages the following tables in the configured database:
| Table | Purpose |
|---|---|
nexjob_jobs |
Job records, serialized arguments, execution state, retries, and errors |
nexjob_recurring |
Recurring cron schedules and execution state |
nexjob_heartbeats |
Active worker node registration and health status |
nexjob_settings |
Dynamic runtime settings and queue controls |
Connection String Example
{
"ConnectionStrings": {
"NexJobConnection": "Server=tcp:sqlserver.database.windows.net,1433;Initial Catalog=nexjob;User ID=admin;Password=secret;Encrypt=True;TrustServerCertificate=False;"
}
}
Connection pool
NexJob shares your database with other applications. A node needs about Workers + 5 connections, so set Max 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 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.89)
- Microsoft.Data.SqlClient (>= 5.2.2)
- NexJob (>= 6.2.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 |
|---|---|---|
| 6.5.1 | 31 | 10/17/2026 |
| 6.5.0 | 32 | 10/17/2026 |
| 6.4.0 | 39 | 10/16/2026 |
| 6.3.0 | 84 | 10/12/2026 |
| 6.2.1 | 82 | 10/11/2026 |
| 6.2.0 | 87 | 10/10/2026 |
| 6.1.0 | 82 | 10/10/2026 |
| 6.0.0 | 91 | 10/9/2026 |
| 5.10.0 | 84 | 10/8/2026 |
| 5.9.0 | 86 | 10/5/2026 |
| 5.8.0 | 93 | 10/4/2026 |
| 5.7.0 | 86 | 10/1/2026 |
| 5.6.2 | 84 | 10/1/2026 |
| 5.6.1 | 88 | 9/30/2026 |
| 5.6.0 | 86 | 9/30/2026 |
| 5.5.0 | 96 | 9/25/2026 |
| 5.4.1 | 88 | 9/24/2026 |
| 5.4.0 | 93 | 9/24/2026 |
| 5.3.0 | 89 | 9/21/2026 |
| 5.2.0 | 105 | 9/20/2026 |