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.
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.
- RabbitMQ-based
IMessageBusimplementation - RabbitMQ connection lifecycle management
- Publish / Subscribe support through RabbitMQ exchange, queue, and routing key
MessageEnvelopeJSON 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
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.
RabbitMqMessageBus implements IMessageBus.
Responsibilities:
- Connect to a RabbitMQ server
- Declare exchange, queue, and queue binding topology
- Publish
MessageEnvelopemessages - Subscribe to a route and dispatch received messages to registered handlers
- Manage RabbitMQ connection and channel lifecycle
- Update connection state through the
ConnectionStatecontract
Defines RabbitMQ connection and routing settings.
Typical fields:
HostNamePortVirtualHostUserNamePasswordExchangeNameQueueNameRoutingKey
RabbitMQ-specific exception type for communication-layer failures.
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.default.exchange",
QueueName = "dreamine.default.queue",
RoutingKey = "dreamine.default.route"
});
await bus.ConnectAsync();
await bus.SubscribeAsync(
"dreamine.default.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.default.route",
Payload = System.Text.Encoding.UTF8.GetBytes("test"),
Headers = new Dictionary<string, string>
{
["ContentType"] = "text/plain",
["Protocol"] = "RabbitMQ"
}
});
await bus.DisconnectAsync();For local validation, RabbitMQ can be started through Docker.
docker run -d --name dreamine-rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-managementRabbitMQ Management UI:
http://localhost:15672
Default credentials:
guest / guest
Sample configuration:
Host localhost
Port 5672
VirtualHost /
User guest
Password guest
Exchange dreamine.default.exchange
Queue dreamine.default.queue
RoutingKey dreamine.default.route
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
MessageEnvelopeJSON serialization and deserialization- Communication Monitor channel state update
- Communication Monitor SEND / RECV message logs
- Keep broker-specific implementation isolated from upper layers.
- Depend on
Dreamine.Communication.Abstractionscontracts. - Keep package responsibilities small and explicit.
- Preserve one-way dependency flow.
- Keep RabbitMQ optional and replaceable.
- Allow application logic to use
IMessageBuswithout knowing RabbitMQ details. - Avoid leaking RabbitMQ.Client types into application-level code.
Dreamine.Communication.AbstractionsRabbitMQ.Client
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.
net8.0
Dreamine.Communication.AbstractionsDreamine.Communication.CoreDreamine.Communication.SocketsDreamine.Communication.SerialDreamine.Communication.RabbitMQDreamine.Communication.FullKitDreamine.Communication.Wpf
This project is licensed under the MIT License.