Soenneker.Redis.WorkQueue 4.0.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Redis.WorkQueue --version 4.0.2
                    
NuGet\Install-Package Soenneker.Redis.WorkQueue -Version 4.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Redis.WorkQueue" Version="4.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Redis.WorkQueue" Version="4.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Redis.WorkQueue" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Redis.WorkQueue --version 4.0.2
                    
#r "nuget: Soenneker.Redis.WorkQueue, 4.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Redis.WorkQueue@4.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Redis.WorkQueue&version=4.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Redis.WorkQueue&version=4.0.2
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image 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.

The partition key is the fairness and concurrency boundary. In Leadping, 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 Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
4.0.3 54 8/14/2026
4.0.2 43 8/14/2026
4.0.1 42 8/14/2026