Pdsr.Queue.Redis
1.0.1
dotnet add package Pdsr.Queue.Redis --version 1.0.1
NuGet\Install-Package Pdsr.Queue.Redis -Version 1.0.1
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="Pdsr.Queue.Redis" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pdsr.Queue.Redis --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Pdsr.Queue.Redis, 1.0.1"
#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.
// Install Pdsr.Queue.Redis as a Cake Addin #addin nuget:?package=Pdsr.Queue.Redis&version=1.0.1 // Install Pdsr.Queue.Redis as a Cake Tool #tool nuget:?package=Pdsr.Queue.Redis&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Pdsr Simple Redis Queue
Uses Redis to act as a Message Queue.
Getting started
Install the package
dotnet add package Pdsr.Queue.Redis
Add it to the DI
// Add to DI
builder.Services.AddRedisQueue(new RedisConfiguration
{
EndPoints = new[] { "localhost:6379" }
});
Define some class to use as message
/// <summary>
/// Some message sample
/// </summary>
public class SampleMessage
{
public SampleMessage(string item)
{
Item = item;
}
// can be anything. be careful not to send large objects.
public string Item { get; }
}
Publishing the message
app.MapGet("/", async (IRedisQueue redisQueue) =>
{
// create an instance of the message object
string contents = "Peeling an apple";
var message = new SampleMessage(contents);
// publish it
await redisQueue.Publish(message);
// return the message object, just because it's cool to see what we sent to the queue
return Results.Ok(message);//show the message
});
Process messages
Inject the IRedisQueue
in a worker or some service and fetch messages one at the time
// fetch messages from queue and process them
await _redisQueue.FetchMessage(async (msg) =>
{
Console.WriteLine($"do something with the msg");
return true; // return true to ACK (and discard the message) or return false and do a NACK requeue.
};);
Preferably use a Background worker, as the whole point for me to use Message Queue was to process them separately on a worker not in Services or Controllers.
ToDo
Make Subscriber pattern to emit events, instead of using a manual fetch
Contribute
Please refer to contribute. Contributions are welcomed, refer to ToDo
Documents
Above is enough for now.
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
- Pdsr.Cache.Redis (>= 3.2.1)
- System.Text.Json (>= 7.0.2)
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.0.1 | 219 | 2/26/2023 |