RapidMQ 1.1.1

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

RapidMQ - Simplified Customizable RabbitMQ Client Library

License: Apache-2.0 .NET C# Nuget NuGet

Introduction

RapidMQ is a simplified wrapper of RabbitMQ library, designed to help developers manage RabbitMQ interactions more easily, particularly by providing easy ways to configure channels with different attributes such as prefetch count, prefetch size and other settings. Library is designed to work with the so called RapidChannels which are wrappers of IModel interface. RapidChannels are designed to be used in a way that each channel is responsible it's routing the consumed messages to the appropriate client handler. This way, developers can easily manage their queues and their interactions with RabbitMQ based on the channel configurations.

Key Features

  • Simple interface to RabbitMQ (Requires basic knowledge of RabbitMQ)
  • Distinct handling of channels based on channel configurations
  • Easy queue binding and setup
  • In-built retry mechanisms for connection stability
  • A design focusing on delivering messages effectively and consistently
  • Message handlers contain more context about the message, not only the message body
  • Support dependency injection for message handlers and other components

Getting Started

dotnet add package RapidMq

A simple view on using the library to setup a channel

IConnectionManager connectionManager = new ConnectionManager(logger);

var factory = new RapidMqConnectionFactory(connectionManager, logger);

var rapidMq = factory.CreateAsync(new Uri("amqp://localhost"), new ConnectionManagerSettings(...));

rapidMq.GetOrCreateExchange("IoT", "topic");
var alertReceivedQueue = rapidMq.DeclareQueue("alert.received.queue");

var alertQueueBinding = rapidMq.GetOrCreateQueueBinding(alertReceivedQueue, iotExchange, "alert.received");

// setting up the channels
var alertProcessingChannel = rapidMq.CreateRapidChannel(new ChannelConfig("alertProcessingChannel", 300));

using var scope = _serviceProvider.CreateScope();
var alertHandler = scope.ServiceProvider.GetRequiredService<IMqMessageHandler<AlertReceivedEvent>>();

// setting up the channel listeners
alertProcessingChannel.Listen(alertQueueBinding, alertHandler);

A simple view on creating a message handler


##Defining the message format
[MqEventRoutingKey("alert.received")]
public class AlertReceivedEvent : MqMessage
{
    public string Name { get; set; }
    public int AlertSeverity { get; set; }
}

// Defining the message handler
public class AlertReceivedEventHandler : IMqMessageHandler<AlertReceivedEvent>
{
    public async Task Handle(MessageContext<AlertReceivedEvent> context)
    {
        Console.WriteLine($"Processing event with payload: {context.Message}");

        await _someService.DoSomethingAsync();

        Console.WriteLine(
            $"Processing event with payload: {context.Message} and routingKey: {context.RoutingKey} completed");
    }
}

A simple view on using the library to publish a message


public class SomeService 
{
    private readonly IRapidMq _rapidMq;
    
    public SomeService(IRapidMq rapidMq)
    {
        _rapidMq = rapidMq;
    }
    
    public void PublishAlertReceivedEventAsync()
    {
        var @alertReceivedEvent = new AlertReceivedEvent
        {
            Name = "Alert 1",
            AlertSeverity = 1
        };

        _rapidMq.PublishMessage(exchangeName, routingKey, @alertReceivedEvent);
    }
}

For more details on setting up and configuring the library, please refer to the .NetCoreAPI Example

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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.  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.1 376 10/17/2023
1.1.0 222 10/1/2023
1.0.2 217 9/30/2023
1.0.1 197 9/26/2023
1.0.0 214 9/17/2023