Dreamine.Communication.RabbitMQ 1.0.0

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

Dreamine.Communication.RabbitMQ

Dreamine.Communication.RabbitMQ is part of the Dreamine Communication package family.

This package provides a RabbitMQ-based IMessageBus implementation for Dreamine Communication. It connects the common Dreamine message contract, MessageEnvelope, to RabbitMQ exchange, queue, and routing key based publish/subscribe messaging.

➡️ 한국어 문서 보기

Description

RabbitMQ message bus adapter for Dreamine Communication.

This package is responsible for integrating RabbitMQ as an optional broker-backed message bus while keeping upper application layers dependent only on Dreamine.Communication.Abstractions.

Features

  • RabbitMQ-based IMessageBus implementation
  • RabbitMQ connection lifecycle management
  • Publish / Subscribe support through RabbitMQ exchange, queue, and routing key
  • MessageEnvelope JSON serialization and deserialization
  • RabbitMQ topology declaration
    • Exchange
    • Queue
    • Queue binding
  • RabbitMQ options model
  • RabbitMQ-specific communication exception type
  • Communication Monitor sample compatibility
  • Docker RabbitMQ server validation scenario

Package Role

Dreamine.Communication.Abstractions
    ↑
Dreamine.Communication.RabbitMQ

Dreamine.Communication.RabbitMQ depends on the abstraction contracts and provides a concrete RabbitMQ adapter.

Application code should depend on IMessageBus, MessageEnvelope, and shared communication contracts instead of depending directly on RabbitMQ-specific implementation types.

Main Components

RabbitMqMessageBus

RabbitMqMessageBus implements IMessageBus.

Responsibilities:

  • Connect to a RabbitMQ server
  • Declare exchange, queue, and queue binding topology
  • Publish MessageEnvelope messages
  • Subscribe to a route and dispatch received messages to registered handlers
  • Manage RabbitMQ connection and channel lifecycle
  • Update connection state through the ConnectionState contract

RabbitMqMessageBusOptions

Defines RabbitMQ connection and routing settings.

Typical fields:

  • HostName
  • Port
  • VirtualHost
  • UserName
  • Password
  • ExchangeName
  • QueueName
  • RoutingKey

RabbitMqCommunicationException

RabbitMQ-specific exception type for communication-layer failures.

Basic Usage

using Dreamine.Communication.Abstractions.Models;
using Dreamine.Communication.RabbitMQ.Buses;
using Dreamine.Communication.RabbitMQ.Options;

var bus = new RabbitMqMessageBus(
    new RabbitMqMessageBusOptions
    {
        HostName = "localhost",
        Port = 5672,
        VirtualHost = "/",
        UserName = "guest",
        Password = "guest",
        ExchangeName = "dreamine.sample.exchange",
        QueueName = "dreamine.sample.queue",
        RoutingKey = "dreamine.sample.route"
    });

await bus.ConnectAsync();

await bus.SubscribeAsync(
    "dreamine.sample.route",
    async (message, cancellationToken) =>
    {
        var text = System.Text.Encoding.UTF8.GetString(message.Payload);
        Console.WriteLine(text);
        await Task.CompletedTask;
    });

await bus.PublishAsync(
    new MessageEnvelope
    {
        Name = "RabbitMQ.Publish",
        Route = "dreamine.sample.route",
        Payload = System.Text.Encoding.UTF8.GetBytes("test"),
        Headers = new Dictionary<string, string>
        {
            ["ContentType"] = "text/plain",
            ["Protocol"] = "RabbitMQ"
        }
    });

await bus.DisconnectAsync();

RabbitMQ Test Server

For local validation, RabbitMQ can be started through Docker.

docker run -d --name dreamine-rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management

RabbitMQ Management UI:

http://localhost:15672

Default credentials:

guest / guest

Sample configuration:

Host        localhost
Port        5672
VirtualHost /
User        guest
Password    guest
Exchange    dreamine.sample.exchange
Queue       dreamine.sample.queue
RoutingKey  dreamine.sample.route

Validated Scenario

The RabbitMQ adapter has been validated with the Dreamine Communication sample.

Validated flow:

Connect
→ Subscribe
→ Publish
→ Receive
→ Monitor SEND / RECV log confirmation

Validated items:

  • RabbitMQ Docker container startup
  • RabbitMQ Management UI access
  • RabbitMQ connection
  • Exchange / queue / routing key topology declaration
  • Message publish
  • Message receive through subscription handler
  • MessageEnvelope JSON serialization and deserialization
  • Communication Monitor channel state update
  • Communication Monitor SEND / RECV message logs

Design Principles

  • Keep broker-specific implementation isolated from upper layers.
  • Depend on Dreamine.Communication.Abstractions contracts.
  • Keep package responsibilities small and explicit.
  • Preserve one-way dependency flow.
  • Keep RabbitMQ optional and replaceable.
  • Allow application logic to use IMessageBus without knowing RabbitMQ details.
  • Avoid leaking RabbitMQ.Client types into application-level code.

Dependencies

  • Dreamine.Communication.Abstractions
  • RabbitMQ.Client

Third-party License Notice

This package uses RabbitMQ.Client.

RabbitMQ.Client is dual-licensed under:

  • Apache License 2.0
  • Mozilla Public License 2.0

This package uses RabbitMQ.Client under the Apache License 2.0 option.

Target Framework

net8.0
  • Dreamine.Communication.Abstractions
  • Dreamine.Communication.Core
  • Dreamine.Communication.Sockets
  • Dreamine.Communication.Serial
  • Dreamine.Communication.RabbitMQ
  • Dreamine.Communication.FullKit
  • Dreamine.Communication.Wpf

License

This project is licensed under the MIT License.

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.0.0 103 5/14/2026