Rebus.Redis
0.0.0-pre001
See the version list below for details.
dotnet add package Rebus.Redis --version 0.0.0-pre001
NuGet\Install-Package Rebus.Redis -Version 0.0.0-pre001
<PackageReference Include="Rebus.Redis" Version="0.0.0-pre001" />
paket add Rebus.Redis --version 0.0.0-pre001
#r "nuget: Rebus.Redis, 0.0.0-pre001"
// Install Rebus.Redis as a Cake Addin #addin nuget:?package=Rebus.Redis&version=0.0.0-pre001&prerelease // Install Rebus.Redis as a Cake Tool #tool nuget:?package=Rebus.Redis&version=0.0.0-pre001&prerelease
Rebus Redis
This library provides Redis support for Saga persistence, outbox, and async messaging.
This is specifically designed to implement scatter/gather commands, where we want to send a single logical command to multiple services in parallel, then return data from one or more of those services to the caller.
There is an existing async library for Rebus which uses the normal Rebus transport to send a reply, however it is marked experimental and the reasoning given for this is quite a reasonable one that durable messages are not suitable for the ephemeral state of an async request. In place of using the normal Rebus transport, this library uses Redis pub/sub to send the reply, which is well suited to the ephemeral nature of async requests.
Using async you can make a call like this on the client:
var response = await bus.SendRequest<ReplyMessage>(request);
This will send the message to the server as normal, as well as add a task to the Redis pub/sub subscription. On the server you can then do a simple like this:
await bus.ReplyAsync(replyMessage);
However there are also some additional methods to allow some additional flexibility. Calling GetReplyContext
in the
context of a Redis async request will return a context to allow you to send a reply at some later date. This context
can be added to a saga state, allowing a future message to reply to the original request.
var replyContext = messageContext.GetReplyContext();
await replyContext.ReplyAsync(replyMessage);
Additionally, the timeout for the caller is sent along with the request so that the recipient of a message can determine how long the caller will be waiting for a response, which may be useful for cancelling a task or determining whether to send a response to the caller.
// in the client (the default timeout is 15 seconds if not specified)
var response = await bus.SendRequest<ReplyMessage>(request, timeout: TimeSpan.FromSeconds(30));
// on the handler
var timeout = messageContext.GetReplyTimeout();
Sage Storage and Outbox
This library also provides a Redis implementation of the saga storage and an outbox implementation modeled after the Postgres implementation in Rebus. The outbox is implemented using Redis streams, while sage data is stored using hashes.
Basic configuration for the saga storage and outbox is as follows:
using var activationHandler = new BuiltinHandlerActivator();
Configure.With(activationHandler)
.Options(o =>
{
o.SetBusName("main");
o.EnableRedis("localhost:6379", r => r.EnableAsync());
})
.Outbox(o => o.StoreInRedis())
.Sagas(s => s.StoreInRedis());
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Rebus (>= 8.0.0-alpha11)
- StackExchange.Redis (>= 2.6.122)
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 |
---|---|---|
0.0.1 | 204 | 2/8/2024 |
0.0.0-pre001 | 202 | 11/6/2023 |