Skip to content

ExchangeBoundDescriptor

ExchangeBoundDescriptor extends ExchangeDescriptor and represents an exchange that participates in a topology definition.

It is primarily used by publisher descriptors to describe:

  • exchange declarations;
  • exchange-to-exchange bindings;
  • exchange-to-queue bindings.

Inheritance

classDiagram
    direction TB

    class ServiceDescriptor

    class ExchangeDescriptor

    class ExchangeBoundDescriptor

    ServiceDescriptor <|-- ExchangeDescriptor
    ExchangeDescriptor <|-- ExchangeBoundDescriptor

Purpose

Unlike ExchangeDescriptor, which only describes a RabbitMQ exchange, ExchangeBoundDescriptor can also describe:

  • child exchanges;
  • bound queues;
  • routing topology.

Topology Composition

graph TD

    ExchangeBoundDescriptor

    QueueBoundDescriptor

    ExchangeBoundDescriptor2["ExchangeBoundDescriptor"]

    ExchangeBoundDescriptor --> QueueBoundDescriptor

    ExchangeBoundDescriptor --> ExchangeBoundDescriptor2

Properties

Inherited from:

  • ServiceDescriptor
  • ExchangeDescriptor

Additional properties:

Property Description
Queues Child queues bound to the exchange.
Exchanges Child exchanges bound to the exchange.

Exchange To Queue

new ExchangeBoundDescriptor
{
    Name = "orders",
    Type = ExchangeTypes.Direct,

    Queues =
    {
        new QueueBoundDescriptor
        {
            Name = "orders.created"
        }
    }
};

Exchange To Exchange

new ExchangeBoundDescriptor
{
    Name = "orders",

    Exchanges =
    {
        new ExchangeBoundDescriptor
        {
            Name = "orders.integration"
        }
    }
};

Nested Topologies

Exchange hierarchies can be nested.

graph LR

    Orders --> Integration

    Integration --> Audit

    Integration --> Analytics

Example:

new ExchangeBoundDescriptor
{
    Name = "orders",

    Exchanges =
    {
        new ExchangeBoundDescriptor
        {
            Name = "integration",

            Exchanges =
            {
                new ExchangeBoundDescriptor
                {
                    Name = "audit"
                },

                new ExchangeBoundDescriptor
                {
                    Name = "analytics"
                }
            }
        }
    }
};

Runtime Behavior

graph LR

    Descriptor --> RabbitMQTopology

The provider traverses the descriptor tree and creates:

  • exchanges;
  • queues;
  • bindings.

When To Use

Use ExchangeBoundDescriptor when:

  • configuring publisher topologies;
  • declaring exchanges;
  • declaring queues attached to exchanges;
  • declaring exchange chains.

  • ExchangeDescriptor
  • QueueBoundDescriptor
  • BinderDescriptor
  • PublisherBoundDescriptor