Skip to content

Descriptor Lifecycle

Descriptors describe RabbitMQ topology and client runtime behavior.

They are not active runtime components by themselves. They are consumed by publishers, subscribers and routing bridges when the client is created or started.


Lifecycle Overview

graph LR
    Descriptor["Descriptor"]
    Client["Bound Client"]
    RabbitMQ["RabbitMQ"]
    Runtime["Runtime Behavior"]

    Descriptor --> Client
    Client --> RabbitMQ
    Client --> Runtime

Descriptor Responsibilities

Descriptors define:

  • exchanges;
  • queues;
  • bindings;
  • routing keys;
  • retry policies;
  • delivery confirmation;
  • channel event registration;
  • publisher and subscriber runtime options.

Client Responsibilities

Clients consume descriptors and apply them to RabbitMQ.

graph TD
    PublisherBoundDescriptor --> Publisher
    SubscriberBoundDescriptor --> Subscriber
    RoutingBridgeDescriptor --> RoutingBridge

    Publisher --> RabbitMQ
    Subscriber --> RabbitMQ
    RoutingBridge --> RabbitMQ

Topology Creation

Publisher and subscriber descriptors are used to create or bind RabbitMQ objects.

graph LR
    Descriptor --> Exchange
    Descriptor --> Queue
    Descriptor --> Binding

The descriptor model allows topology to be defined declaratively instead of hardcoding RabbitMQ operations in application logic.


Runtime Behavior

Descriptors also configure runtime behavior.

Examples:

Descriptor Runtime Behavior
PublisherBoundDescriptor Publishing topology, publish retries, delivery confirmation, channel events.
SubscriberBoundDescriptor Queue consumption, prefetch count, retry behavior, channel events.
RoutingBridgeDescriptor Source subscriber and target publisher configuration.
RetryPolicyDescriptor Consumer retry behavior.
PubRetryPolicyDescriptor Publisher retry behavior.
DeliveryConfirmation Publisher confirmation behavior.

Logical Name To RabbitMQ Object

Topology descriptors inherit the naming model from ServiceDescriptor.

graph LR
    Name --> FullName
    Prefix --> FullName
    FullName --> RabbitMQObject["RabbitMQ Object"]

The provider creates RabbitMQ objects using FullName.

This is documented in detail in:

Reference / Descriptors / Topology / ServiceDescriptor

Use descriptors to keep topology and runtime behavior:

  • centralized;
  • configurable;
  • testable;
  • independent from business code.

Avoid spreading RabbitMQ declaration logic across the application.