RedisStorm 10.0.0

dotnet add package RedisStorm --version 10.0.0
                    
NuGet\Install-Package RedisStorm -Version 10.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="RedisStorm" Version="10.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RedisStorm" Version="10.0.0" />
                    
Directory.Packages.props
<PackageReference Include="RedisStorm" />
                    
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 RedisStorm --version 10.0.0
                    
#r "nuget: RedisStorm, 10.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 RedisStorm@10.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=RedisStorm&version=10.0.0
                    
Install as a Cake Addin
#tool nuget:?package=RedisStorm&version=10.0.0
                    
Install as a Cake Tool

RedisStorm

CI NuGet License: MIT .NET

A lightweight wrapper around StackExchange.Redis that simplifies Redis pub/sub with dependency injection, attribute-based channel binding, and optional MessagePack serialization.

Features

  • JSON or MessagePack serialization for pub/sub payloads
  • Register subscribers from your assembly with [RedisChannel("channel-name")]
  • Manual channel binding via ConfigSubscriber<TSubscriber>(channel)
  • Scoped subscriber handlers with full DI support (inject your own services into Handle)
  • Works with IConnectionMultiplexer registered in your container or passed directly

Requirements

  • .NET 10 SDK
  • Redis 6+ (required when running subscribers)

Installation

dotnet add package RedisStorm --version 10.0.0

Package Manager:

Install-Package RedisStorm -Version 10.0.0

Quick start

using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using RedisStorm.Extensions;
using RedisStorm.Registration;
using StackExchange.Redis;

var builder = Host.CreateApplicationBuilder(args);

builder.Services.AddSingleton<IConnectionMultiplexer>(
    ConnectionMultiplexer.Connect(builder.Configuration.GetConnectionString("Redis")!));

builder.Services.AddRedisStorm(Assembly.GetExecutingAssembly(), factory =>
{
    factory.AddConnectionMultiplexerFromServiceCollection();

    factory.AddPublisher(p => p.SerializationType = SerializationType.Json);

    factory.AddSubscribers(s =>
    {
        s.SerializationType = SerializationType.Json;
        s.AddSubscribersFromAssembly();
    });
});

var host = builder.Build();
await host.RunAsync();

Subscriber

using RedisStorm.Attributes;
using RedisStorm.Interfaces;

[RedisChannel("orders-created")]
public sealed class OrderCreatedSubscriber : ISubscriber<OrderCreatedMessage>
{
    private readonly ILogger<OrderCreatedSubscriber> _logger;

    public OrderCreatedSubscriber(ILogger<OrderCreatedSubscriber> logger) => _logger = logger;

    public Task Handle(OrderCreatedMessage message, CancellationToken cancellationToken)
    {
        _logger.LogInformation("Order {OrderId} created", message.OrderId);
        return Task.CompletedTask;
    }
}

Use [RedisChannel] when registering subscribers via AddSubscribersFromAssembly().

Publisher

using RedisStorm.Services;

public sealed class OrderService(IRedisPublisher publisher)
{
    public Task NotifyOrderCreatedAsync(OrderCreatedMessage message, CancellationToken cancellationToken) =>
        publisher.Publish("orders-created", message, cancellationToken);
}

AddPublisher must be called inside AddRedisStorm for IRedisPublisher to be registered.

Configuration

Setting Where Default Description
Publisher serialization AddPublisherSerializationType Json Format for published payloads
Subscriber serialization AddSubscribersSerializationType Json Format for incoming payloads
Multiplexer AddConnectionMultiplexer or AddConnectionMultiplexerFromServiceCollection How Redis connects
Assembly scan AddSubscribersFromAssembly() off Auto-bind types with [RedisChannel]
Manual channel ConfigSubscriber<T>(channel) Bind a subscriber without attributes

MessagePack note: Message types must be compatible with MessagePack (e.g. [MessagePackObject]). Payloads are sent as Base64-encoded strings on the wire.

Building and testing

dotnet restore
dotnet build -c Release
dotnet test -c Release --filter "Category!=Integration"

Integration tests require Redis on localhost:6379:

docker run -d -p 6379:6379 redis:7-alpine
dotnet test -c Release --filter "Category=Integration"

Contributing

See CONTRIBUTING.md. Bug reports and feature requests are welcome via GitHub Issues.

License

This project is licensed under the MIT License.

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.