ExchangeDescriptor¶
ExchangeDescriptor describes a RabbitMQ exchange.
It derives from ServiceDescriptor, so it inherits the naming model based on Prefix, Name and FullName.
Inheritance¶
classDiagram
direction TB
class ServiceDescriptor {
+string Prefix
+string Name
+string FullName
}
class ExchangeDescriptor {
+ExchangeTypes Type
+bool Durable
+bool AutoDelete
+IDictionary~string, object~ Arguments
}
ServiceDescriptor <|-- ExchangeDescriptor
Purpose¶
Use ExchangeDescriptor when a client needs to describe an exchange that participates in a subscriber binding or topology definition.
For publisher topologies, ExchangeBoundDescriptor extends this model with binding composition.
Naming¶
ExchangeDescriptor uses the default prefix:
esb/exchange
Example:
new ExchangeDescriptor
{
Name = "orders"
};
The physical RabbitMQ exchange name is:
esb/exchange/orders
The provider uses FullName when declaring the exchange.
Properties¶
| Property | Description |
|---|---|
Name |
Logical exchange name. |
Prefix |
Exchange namespace prefix. |
FullName |
Physical RabbitMQ exchange name. |
Type |
RabbitMQ exchange type. |
Durable |
Indicates whether the exchange survives broker restarts. |
AutoDelete |
Indicates whether the exchange can be automatically deleted. |
Arguments |
RabbitMQ exchange declaration arguments. |
Exchange Type¶
Type defines how RabbitMQ routes messages through the exchange.
Common values are:
direct
topic
fanout
headers
Example:
var exchange = new ExchangeDescriptor
{
Name = "orders",
Type = ExchangeTypes.Topic,
Durable = true,
AutoDelete = false
};
Runtime Behavior¶
graph LR
ExchangeDescriptor --> FullName
FullName --> RabbitMQExchange["RabbitMQ Exchange"]
The descriptor does not route messages directly.
It describes the exchange that the provider should declare and use.
When To Use¶
Use ExchangeDescriptor when configuring subscriber-side exchange binding.
Use ExchangeBoundDescriptor when the exchange also needs to describe queues or child exchanges in a publisher topology.
Related Descriptors¶
ServiceDescriptorExchangeBoundDescriptorSubscriberBoundDescriptorBinderDescriptor