Table of Contents

Interface IRabbitMQRoutingBuilder

Namespace
Excalibur.Dispatch.Transport.RabbitMQ
Assembly
Excalibur.Dispatch.Transport.RabbitMQ.dll

Builder interface for configuring RabbitMQ message routing and SSL.

public interface IRabbitMQRoutingBuilder
Extension Methods

Remarks

Provides methods for mapping message types to exchanges and queues, setting name prefixes, and enabling SSL/TLS connections.

Methods

MapExchange<TMessage>(string)

Maps a message type to a specific exchange for routing.

IRabbitMQTransportBuilder MapExchange<TMessage>(string exchange) where TMessage : class

Parameters

exchange string

The target exchange name.

Returns

IRabbitMQTransportBuilder

The builder for chaining.

Type Parameters

TMessage

The message type to map.

Exceptions

ArgumentException

Thrown when exchange is null or whitespace.

MapQueue<TMessage>(string)

Maps a message type to a specific queue for routing.

IRabbitMQTransportBuilder MapQueue<TMessage>(string queue) where TMessage : class

Parameters

queue string

The target queue name.

Returns

IRabbitMQTransportBuilder

The builder for chaining.

Type Parameters

TMessage

The message type to map.

Exceptions

ArgumentException

Thrown when queue is null or whitespace.

RequireTls(bool)

Sets whether an unencrypted broker connection is refused.

IRabbitMQTransportBuilder RequireTls(bool required)

Parameters

required bool

true to refuse to build a connection factory that would connect in the clear; false to permit one. Defaults to refusing.

Returns

IRabbitMQTransportBuilder

The builder for chaining.

Examples

// A development broker with no certificate:
rabbit.ConnectionString("amqp://guest:guest@localhost:5672").RequireTls(false);

Remarks

The refusal happens when the connection factory is built, so a plaintext registration fails where it is wired rather than at the first message. A connection carries TLS when its connection string uses the amqps scheme or when UseSsl(Action<RabbitMQSslOptions>?) has been called.

Passing false permits credentials and message payloads to travel in the clear. It exists for local brokers and test fixtures, not for anything holding real data.

UseSsl(Action<RabbitMQSslOptions>?)

Enables SSL/TLS for the connection.

IRabbitMQTransportBuilder UseSsl(Action<RabbitMQSslOptions>? configure = null)

Parameters

configure Action<RabbitMQSslOptions>

Optional action to configure SSL options.

Returns

IRabbitMQTransportBuilder

The builder for chaining.

WithExchangePrefix(string)

Sets a prefix to be applied to all exchange names.

IRabbitMQTransportBuilder WithExchangePrefix(string prefix)

Parameters

prefix string

The exchange name prefix (e.g., "myapp-prod-").

Returns

IRabbitMQTransportBuilder

The builder for chaining.

Exceptions

ArgumentException

Thrown when prefix is null or whitespace.

WithQueuePrefix(string)

Sets a prefix to be applied to all queue names.

IRabbitMQTransportBuilder WithQueuePrefix(string prefix)

Parameters

prefix string

The queue name prefix (e.g., "myapp-prod-").

Returns

IRabbitMQTransportBuilder

The builder for chaining.

Exceptions

ArgumentException

Thrown when prefix is null or whitespace.