Skip to content

BinderDescriptor

BinderDescriptor describes how RabbitMQ objects are connected together.

It provides the binding metadata used when creating:

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

Purpose

RabbitMQ bindings define message routing.

The binder descriptor allows routing configuration to remain independent from queue and exchange declarations.

graph LR

    Exchange --> Binder

    Binder --> Queue

Properties

Property Description
RoutingKey Routing key used by the binding.
Arguments Additional RabbitMQ binding arguments.

Direct Exchange Binding

new BinderDescriptor
{
    RoutingKey = "orders.created"
};

Topology:

graph LR

    Exchange -->|"orders.created"| Queue

Topic Exchange Binding

new BinderDescriptor
{
    RoutingKey = "orders.eu.*"
};

Topology:

graph LR

    Exchange -->|"orders.eu.*"| Queue

Fanout Exchange

Fanout exchanges ignore routing keys.

new BinderDescriptor();

or

new BinderDescriptor
{
    RoutingKey = string.Empty
};

Header-Based Binding

RabbitMQ header exchanges use binding arguments.

Example:

new BinderDescriptor
{
    Arguments =
    {
        ["x-match"] = "all",
        ["region"] = "eu",
        ["priority"] = "high"
    }
};

Runtime Behavior

graph LR

    BindingMetadata --> RabbitMQBinding

The provider uses the descriptor to create RabbitMQ bindings.


Routing Key Guidelines

Prefer business-oriented routing keys.

Recommended:

orders.created
orders.updated

payments.completed
payments.failed

Topic routing:

orders.eu.created
orders.us.created

orders.eu.updated
orders.us.updated

Avoid:

event1
event2
test

When To Use

Use BinderDescriptor whenever routing behavior must be configured independently from queue and exchange declarations.


  • ExchangeBoundDescriptor
  • QueueBoundDescriptor
  • ExchangeDescriptor
  • QueueDescriptor