RabbitMQ.Connect.Helper
1.0.7
See the version list below for details.
dotnet add package RabbitMQ.Connect.Helper --version 1.0.7
NuGet\Install-Package RabbitMQ.Connect.Helper -Version 1.0.7
<PackageReference Include="RabbitMQ.Connect.Helper" Version="1.0.7" />
<PackageVersion Include="RabbitMQ.Connect.Helper" Version="1.0.7" />
<PackageReference Include="RabbitMQ.Connect.Helper" />
paket add RabbitMQ.Connect.Helper --version 1.0.7
#r "nuget: RabbitMQ.Connect.Helper, 1.0.7"
#:package RabbitMQ.Connect.Helper@1.0.7
#addin nuget:?package=RabbitMQ.Connect.Helper&version=1.0.7
#tool nuget:?package=RabbitMQ.Connect.Helper&version=1.0.7
RabbitMQ Connection Helper
A .NET NuGet package to simplify working with RabbitMQ for producing and consuming messages. This package provides an easy-to-use interface for managing connections, exchanges, queues, and publishing/consuming messages in a RabbitMQ environment.
Features
- Asynchronous support for RabbitMQ connections.
- Simplified message publishing and consumption.
- Built-in support for durable queues and exchanges.
- Helper methods for creating producers and consumers.
Installation
Install the package via NuGet Package Manager:
Install-Package RabbitMQ.Connect.Helper
Or via the .NET CLI:
dotnet add package RabbitMQ.Connect.Helper
Usage
1. Add Appsetings.json
"RabbitMqConfig": {
"HostName": "localhost",
"Port": 5672,
"UserName": "guest",
"Password": "guest"
}
2. Setup RabbitMQ Connection -- add this to your program/startup file
services.Configure<RabbitMqConfig>(cxt.Configuration.GetSection("RabbitMqConfig"));
services.AddSingleton<IRabbitMqConsumer, RabbitMqConsumer>();
services.AddSingleton<IRabbitMqProducer, RabbitMqProducer>();
3. Publish Messages
private readonly IRabbitMqConsumer _rabbitMqConsumer;
private readonly IRabbitMqProducer _rabbitMqProducer;
public YourClass(IRabbitMqConsumer rabbitMqConsumer, IRabbitMqProducer rabbitMqProducer)
{
_rabbitMqConsumer = rabbitMqConsumer;
_rabbitMqProducer = rabbitMqProducer;
}
public ProducerExample(){
var queueName = "example-queue";
var message = "Hello, RabbitMQ!";
await _rabbitMqProducer.PublishMessageToQueueAsync(queueName, message);
}
4. Consume Messages
var queueName = "example-queue";
await consumer.ConsumeAsync(queueName, async (message) =>
{
Console.WriteLine($"Received message: {message}");
});
Configuration
- Exchange Type: Supports
direct
,topic
,fanout
, andheaders
. - Durability: Ensures exchanges and queues are durable for reliable messaging.
- Auto Acknowledge: Messages are acknowledged automatically or manually.
Contributing
Contributions are welcome! If you find a bug or want to add a feature, feel free to open an issue or submit a pull request.
License
This package is licensed under the MIT License. See the LICENSE file for details.
Contact
For any issues or questions, feel free to reach out to the maintainer.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Microsoft.Extensions.Options (>= 8.0.1)
- RabbitMQ.Client (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.