Soenneker.Redis.WorkQueue
11.0.173
Prefix Reserved
dotnet add package Soenneker.Redis.WorkQueue --version 11.0.173
NuGet\Install-Package Soenneker.Redis.WorkQueue -Version 11.0.173
<PackageReference Include="Soenneker.Redis.WorkQueue" Version="11.0.173" />
<PackageVersion Include="Soenneker.Redis.WorkQueue" Version="11.0.173" />
<PackageReference Include="Soenneker.Redis.WorkQueue" />
paket add Soenneker.Redis.WorkQueue --version 11.0.173
#r "nuget: Soenneker.Redis.WorkQueue, 11.0.173"
#:package Soenneker.Redis.WorkQueue@11.0.173
#addin nuget:?package=Soenneker.Redis.WorkQueue&version=11.0.173
#tool nuget:?package=Soenneker.Redis.WorkQueue&version=11.0.173
Soenneker.Redis.WorkQueue
A durable, partition-aware Redis work queue with scheduling, leases, retries, deduplication, and round-robin fairness.
Installation
dotnet add package Soenneker.Redis.WorkQueue
Registration
services.AddRedisWorkQueueAsSingleton<SendMessageWork>("send-message", options =>
{
options.MaxConcurrentItemsPerPartition = 2;
options.ClaimLeaseDuration = TimeSpan.FromMinutes(1);
options.MaximumAttempts = 10;
options.MaintenanceInterval = TimeSpan.FromSeconds(1);
});
Registration starts a background maintenance service by default. Every process may register it; a distributed Redis semaphore ensures that only one process maintains a logical queue at a time. Set EnableBackgroundMaintenance to false only when another component calls RunMaintenance periodically.
AddRedisWorkQueueAsScoped<T>() scopes the queue and semaphore wrappers while retaining the shared Redis client transport. Disposing a scope does not close the application's Redis connection.
The partition key is the fairness and concurrency boundary. For a multi-tenant application, for example, use the business ID. Ready partitions are dispatched round-robin, and Soenneker.Redis.Semaphores prevents more than the configured number of claims for one partition across every process.
Enqueue and process
await queue.Enqueue(new RedisWorkQueueItem<SendMessageWork>
{
Id = message.Id,
PartitionKey = message.BusinessId,
Value = new SendMessageWork(message.Id),
AvailableAt = DateTimeOffset.UtcNow // set a future value to schedule it
}, cancellationToken);
await using RedisWorkQueueClaim<SendMessageWork>? claim =
await queue.TryClaim(workerId, cancellationToken);
if (claim is null)
return;
try
{
await Process(claim.Item.Value, claim.OwnershipLostToken);
await queue.Complete(claim, cancellationToken);
}
catch (Exception exception)
{
await queue.Retry(claim, new RedisWorkQueueFailure
{
Reason = exception.GetType().Name,
Details = exception.Message
}, TimeSpan.FromSeconds(10), cancellationToken);
throw;
}
The queue provides at-least-once delivery. Claims automatically renew both their work-item lease and their partition semaphore permit. Background maintenance promotes scheduled items, recovers expired claims, repairs ready partitions, and expires completed-item deduplication markers.
Retry moves work to the dead-letter store when it reaches MaximumAttempts. Use GetDeadLetter and RequeueDeadLetter to inspect and recover valid items. Missing or unreadable payloads are dead-lettered automatically so they cannot block a partition. Use Abandon when a healthy worker needs to relinquish a claim immediately without treating it as a processing failure.
The implementation uses typed Soenneker.Redis.Util operations and Redis transactions with optimistic conditions. It does not use Redis scripts.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Redis.Semaphores (>= 11.0.144)
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 |
|---|---|---|
| 11.0.173 | 0 | 11/15/2026 |
| 11.0.172 | 49 | 11/13/2026 |
| 11.0.171 | 53 | 11/11/2026 |
| 11.0.170 | 50 | 11/11/2026 |
| 11.0.169 | 48 | 11/11/2026 |
| 11.0.168 | 54 | 11/11/2026 |
| 11.0.167 | 66 | 11/11/2026 |
| 11.0.166 | 98 | 11/3/2026 |
| 11.0.165 | 90 | 11/3/2026 |
| 11.0.164 | 90 | 11/3/2026 |
| 11.0.163 | 88 | 11/3/2026 |
| 11.0.161 | 93 | 11/3/2026 |
| 11.0.160 | 91 | 11/2/2026 |
| 11.0.159 | 95 | 11/2/2026 |
| 11.0.158 | 93 | 11/2/2026 |
| 11.0.157 | 104 | 10/31/2026 |
| 11.0.156 | 100 | 10/31/2026 |
| 11.0.155 | 102 | 10/29/2026 |
| 11.0.154 | 102 | 10/29/2026 |
| 11.0.153 | 105 | 10/27/2026 |
Update dependency Soenneker.Redis.Semaphores to 11.0.144 (#131)