RabbitMQClientLibrary 1.0.3.2
See the version list below for details.
dotnet add package RabbitMQClientLibrary --version 1.0.3.2
NuGet\Install-Package RabbitMQClientLibrary -Version 1.0.3.2
<PackageReference Include="RabbitMQClientLibrary" Version="1.0.3.2" />
paket add RabbitMQClientLibrary --version 1.0.3.2
#r "nuget: RabbitMQClientLibrary, 1.0.3.2"
// Install RabbitMQClientLibrary as a Cake Addin #addin nuget:?package=RabbitMQClientLibrary&version=1.0.3.2 // Install RabbitMQClientLibrary as a Cake Tool #tool nuget:?package=RabbitMQClientLibrary&version=1.0.3.2
RabbitMq Connector Middleware
Overview
The RabbitMq Connector Middleware is a powerful tool for integrating RabbitMQ messaging into your application. It provides a simple and efficient way to send and receive messages using RabbitMQ as the messaging broker.
Features
- Easy setup and configuration
- Publish and consume messages with ease
- Support for message acknowledgements and rejections
- Error handling and retry mechanisms
- Extensible and customizable
Installation
To install the RabbitMq Connector Middleware, you can use NuGet:
Usage
Create a config file(appSettings.json) or create a new instance of RabbitMqConfiguration class.
{
"RabbitMqConfiguration": {
"Host": "127.0.0.1",
"Port": 5672,
"Username": "rabbitmq",
"Password": "rabbitmq",
"ConsumerQueueName": "TestAppExchange",
"ConsumerExchangeName": "TestAppQueue",
"PublisherQueueName": "PublishAppExchange",
"PublisherExchangeName": "PublishAppQueue",
"ClusterUrls": ["127.0.0.1"],
"Heartbeat": 15,
"RetryCount": 5,
"ConnectionName": "TestApp"
}
}
var rabbitMqConfig = new RabbitMqConfiguration
{
Host = "127.0.0.1",
Port = 5672,
Username = "guest",
Password = "guest",
Heartbeat = 30,
ClusterUrls = ["127.0.0.1"],
ConnectionName = "TestApp",
ConsumerExchangeName = "TestAppExchange",
ConsumerQueueName = "TestAppQueue",
PublisherExchangeName = "PublishAppExchange",
PublisherQueueName = "PublishAppQueue",
RetryCount = 3
};
Then create a consumer class or publisher class based on RabbitMqPublisherBase<T>
T is model class of message exchange.
Create a publisher class
public class ServerMessageQueuePublisher : RabbitMqPublisherBase<UserMessage>
{
public ServerMessageQueuePublisher(RabbitMqConfiguration rabbitMqConfigOptions,
ILogger<RabbitMqPublisherBase<UserMessage>> logger, IRabbitMqService rabbitMQPersistentConnection)
: base(logger, rabbitMQPersistentConnection, rabbitMqConfigOptions.PublisherQueueName,
rabbitMqConfigOptions.PublisherExchangeName)
{
}
}
///message exchange class
public class UserMessage
{
public string? UserId { get; set; }
public string? UserName { get; set; }
public string? Message { get; set; }
}
Add this class into the DI container.
services.AddSingleton<RabbitMqConfiguration>(rabbitMqConfig);
services.AddScoped<ServerMessageQueuePublisher>();
Then add IRabbitMqService
with logger and configuration
services.AddSingleton<IRabbitMqService, RabbitMqService>(sp =>
{
var logger = sp.GetRequiredService<ILogger<RabbitMqService>>();
var config = sp.GetRequiredService<IOptions<RabbitMqConfiguration>>().Value;
return new RabbitMqService(config, logger);
});
app.UseMiddleware<RabbitMqConnectorMiddleware>();
Thank you.
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
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Hosting (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Polly (>= 8.3.1)
- RabbitMq.Client (>= 6.8.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.