Rmql 1.0.0

dotnet add package Rmql --version 1.0.0
NuGet\Install-Package Rmql -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="Rmql" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rmql --version 1.0.0
#r "nuget: Rmql, 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.
// Install Rmql as a Cake Addin
#addin nuget:?package=Rmql&version=1.0.0

// Install Rmql as a Cake Tool
#tool nuget:?package=Rmql&version=1.0.0

Redis message queue light

Implementation message queue based BackgroundService and StackExchange.Redis

Usage

  1. Create DTO model for in\out queue message
public class MqMessage
{
    public int Id { get; set; }
    public string Message { get; set; }
}
  1. Create shared worker class for settings queue and handle message. Worker should inherits from abstract class RmqlWorker<T> (T is dto model).
public class TestWorker: RmqlWorker<MqMessage>
{
    public override string Key => "TestQueue";
    public override int Frequency => 50;
    public override RedisDbEnum RedisDb => RedisDbEnum.Db0;

    public override Task ActionAsync(IServiceScope serviceScope, MqMessage message)
    {
        Console.WriteLine($"Handling message from {Key}: {message.Id}; {message.Message}");
        return Task.CompletedTask;
    }
}
  1. Register workers to Startup.cs in project for queue handle
public void ConfigureServices(IServiceCollection services)
{
    services.AddRmql(config =>
    {
        config.UseWorker<TestWorker, MqMessage>();
    });
    
    ...
}
  1. Use RmqlClient for send message in queue
public class HomeController : Controller
{
    private readonly RmqlClient _rmqlClient;
    
    public HomeController(RmqlClient rmqlClient)
    {
        _rmqlClient = rmqlClient;
    }

    public async Task<IActionResult> Index()
    {
        var model = new MqMessage
        {
            Id = 1,
            Message = "Message text"
        };
        await _rmqlClient.PushAsync<TestWorker, MqMessage>(model);
        
        return View();
    }
}
  1. [Option] Add services.AddRmql() if only use need RmqlClient in project.
public void ConfigureServices(IServiceCollection services)
{
    services.AddRmql();
    ...
}

Settings

Abstract class RmqlWorker<T> has properties and methods for override:

  • [string] Key - Unique list name for queue message storage
  • [QueueType] Type - Type of queue. Default FIFO
  • [int] Frequency - Delay in milliseconds before check new message in queue. Default 1000ms
  • [RedisDbEnum] RedisDb - Redis db number for queue storage. Default Db0
  • [Task] ActionAsync() - Handling one queue message
  • [Task] LogErrorAsync() - Handling thrown exception
Product 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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.

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.0 286 5/4/2021