BabelQueue.Redis 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package BabelQueue.Redis --version 1.0.0
                    
NuGet\Install-Package BabelQueue.Redis -Version 1.0.0
                    
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="BabelQueue.Redis" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BabelQueue.Redis" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="BabelQueue.Redis" />
                    
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 BabelQueue.Redis --version 1.0.0
                    
#r "nuget: BabelQueue.Redis, 1.0.0"
                    
#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 BabelQueue.Redis@1.0.0
                    
#: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=BabelQueue.Redis&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=BabelQueue.Redis&version=1.0.0
                    
Install as a Cake Tool

BabelQueue.Redis

Redis transport for BabelQueue — "Polyglot Queues, Simplified." Built on StackExchange.Redis and the framework-agnostic BabelQueue.Core.

A canonical-envelope publisher and a URN-routed consumer, so a Redis-based .NET service speaks the same wire contract (envelope shape, URN identity, trace propagation) as the PHP/Laravel, Python, Go, Node and Java SDKs. Implements §1 of the broker-bindings contract — the reliable-queue list pattern.

Install

dotnet add package BabelQueue.Redis

It pulls BabelQueue.Core and StackExchange.Redis transitively.

Use

using BabelQueue.Redis;
using StackExchange.Redis;

var redis = await ConnectionMultiplexer.ConnectAsync("localhost:6379");
IDatabase db = redis.GetDatabase();

// produce
var id = await new RedisPublisher(db, "orders")
    .PublishAsync("urn:babel:orders:created", new Dictionary<string, object?> { ["order_id"] = 1042 });

// consume
var handlers = new Dictionary<string, BabelHandler>
{
    ["urn:babel:orders:created"] = async (env, rawBody, ct) =>
    {
        // env.Data, env.TraceId, env.Attempts ...
    },
};
var consumer = new RedisConsumer(db, "orders", handlers, new RedisConsumerOptions
{
    OnError = (err, env, raw) => Console.Error.WriteLine(err),
});
await consumer.RunAsync(cancellationToken); // polls until cancelled

Contract mapping (§1)

Unlike the SQS/RabbitMQ bindings, a Redis list element carries no native metadata, so there is no header/attribute projection: the list element is the canonical envelope JSON, byte-for-byte, with no wrapping and no added fields. A consumer in any language pops that same body and decodes it.

Envelope Redis
body the list element (byte-identical across SDKs, no wrapping)
job (URN) read from the decoded body (no native metadata to route on)
trace_id / meta.id / … read from the decoded body
produce RPUSH <queue> <envelope>
reserve LMOVE <queue> <queue>:processing LEFT RIGHT (an in-flight message survives a crash)
ack LREM <queue>:processing 1 <envelope>

Reservation follows the reliable-queue pattern (mirroring the Go reference): the head of the queue is atomically moved onto a per-queue <queue>:processing list, then removed on ack. A throwing handler leaves the element on the processing list (at-least-once); the poll loop never stops on a bad message — observe via OnError / OnUnknownUrn. The envelope is unchanged (schema_version stays 1); Redis support is purely additive.

Reliable-queue scope. This is a .NET-owned reliable queue: produce/reserve/ack are self-consistent and crash-safe on a queue this SDK owns end-to-end. Full parity with Laravel's reserved-sorted-set reservation on a shared PHP+.NET Redis queue (queues:<name>:reserved scored by retry_after, attempts incremented by the reservation Lua script) is a separate task — see broker-bindings §1.4.

Build & test

dotnet test

IDatabase is an interface, so the unit tests mock it with Moq — no Redis, no network.

License

MIT

Product 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. 
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
1.1.0 123 6/21/2026
1.0.0 119 6/13/2026