RapidMQ 1.1.1
dotnet add package RapidMQ --version 1.1.1
NuGet\Install-Package RapidMQ -Version 1.1.1
<PackageReference Include="RapidMQ" Version="1.1.1" />
<PackageVersion Include="RapidMQ" Version="1.1.1" />
<PackageReference Include="RapidMQ" />
paket add RapidMQ --version 1.1.1
#r "nuget: RapidMQ, 1.1.1"
#:package RapidMQ@1.1.1
#addin nuget:?package=RapidMQ&version=1.1.1
#tool nuget:?package=RapidMQ&version=1.1.1
RapidMQ - Simplified Customizable RabbitMQ Client Library
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 | Versions 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. |
-
net7.0
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
- Moq (>= 4.20.69)
- Polly (>= 7.2.4)
- RabbitMQ.Client (>= 6.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.