RabbitMQ.Connect.Helper 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package RabbitMQ.Connect.Helper --version 1.0.1
                    
NuGet\Install-Package RabbitMQ.Connect.Helper -Version 1.0.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="RabbitMQ.Connect.Helper" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RabbitMQ.Connect.Helper" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="RabbitMQ.Connect.Helper" />
                    
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 RabbitMQ.Connect.Helper --version 1.0.1
                    
#r "nuget: RabbitMQ.Connect.Helper, 1.0.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 RabbitMQ.Connect.Helper@1.0.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=RabbitMQ.Connect.Helper&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=RabbitMQ.Connect.Helper&version=1.0.1
                    
Install as a Cake Tool

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 ConnectRabbitMq

Or via the .NET CLI:

dotnet add package ConnectRabbitMq

Usage

1. Add Appsetings.json

    "RabbitMqConfig": {
      "HostName": "localhost",
      "Port": 5672,
      "UserName": "guest",
      "Password": "guest"
    }

2. Setup RabbitMQ Connection

var factory = new ConnectionFactory
{
    HostName = "localhost",
    Port     = 5672,
    UserName = "guest",
    Password = "guest",
};

// Create a connection and a channel
using var connection = await factory.CreateConnectionAsync();
using var channel = await connection.CreateChannelAsync();

3. Publish Messages

var exchangeName = "example-exchange";
var routingKey = "example-key";
var message = "Hello, RabbitMQ!";

await RabbitMQHelper.PublishMessageAsync(channel, exchangeName, routingKey, message);

4. Consume Messages

var queueName = "example-queue";

await RabbitMQHelper.ConsumeMessagesAsync(channel, queueName, async (message) =>
{
    Console.WriteLine($"Received: {message}");
    // Process the message
});

5. Helper Methods

PublishMessageAsync

Publishes a message to a specific exchange with a routing key.

await RabbitMQHelper.PublishMessageAsync(channel, exchangeName, routingKey, message);
ConsumeMessagesAsync

Starts consuming messages from a queue.

await RabbitMQHelper.ConsumeMessagesAsync(channel, queueName, messageHandler);

Configuration

  • Exchange Type: Supports direct, topic, fanout, and headers.
  • 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 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. 
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.0 591 5/6/2025
1.0.7 180 4/29/2025
1.0.6 179 4/29/2025
1.0.5 555 2/17/2025
1.0.4 109 1/20/2025
1.0.3 107 1/20/2025
1.0.2 136 12/26/2024
1.0.1 104 12/26/2024
1.0.0 118 12/24/2024