Skip to content

Pondidum/Overseer.RabbitMQ

Repository files navigation

Overseer.RabbitMQ

Provides message reading and conversion for a RabbitMQ source.

Installation

PM> install-package Overseer.RabbitMQ

Configuration

var reader = new RabbitMessageReader(new RabbitOptions
{
  HostName = "192.168.59.103",
  ExchangeName = "DomainEvents"
});

//...
var monitor = new QueueMonitor(reader, new RabbitMessageConverter(), validationSource, output);

RabbitMessageReader

The reader assumes you have an exchange of type Topic, and will bind a temporary queue to this exchange to read messages with. Exchange Name, Durability and AutoDelete can all be configured, and setting SkipExchangeDeclare will force no .ExchangeDeclare() call to be made at all.

RabbitOptions

The configuration options for RabbitMessageReader

HostName

The RabbitMQ host to connect to.

options.HostName = "192.168.59.103";

ExchangeName

The exchange to bind a queue to.

.ExchangeName = "DomainEvents";

RoutingKey

The routing key to use to filter messages. Defaults to #.

options.RoutingKey = "#"; //all messages
options.RoutingKey = "People.*";

ExchangeDurable

Whether the exchange is durable (e.g. will survive a RabbitMQ restart). Defaults to true.

options.ExchangeDurable = true;

ExchangeAutoDelete

Whether to delete the exchange when all queues bound to it have been removed. Defaults to false.

options.ExchangeAutoDelete = false;

ExchangeSkipDeclare

Prevents .ExchangeDeclare() from being called. Defaults to false. When set to true, ExchangeDurable, ExchangeAutoDelete values are ignored.

options.ExchangeSkipDeclare = false;

RabbitMessageConverter

The converter assumes two things: that the message body is a UTF8 Byte Array (or null), which it will convert to a string representation; and that the Type property on the BasicDeliverEventArgs is populated with the message type (which is used to locate the correct validationSource).

If you need to do conversion differently, re-implementing the RabbitMessageConverter is very straight forward. See the source of it for more details.

About

RabbitMQ reader and message converter for Overseer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published