Design Decisions¶
This page explains the rationale behind the most important architectural decisions.
Understanding these decisions helps developers understand not only how the framework works, but why it works that way.
Why Descriptors?¶
One of the first questions developers ask is:
Why use descriptors instead of directly configuring RabbitMQ?
For example:
channel.ExchangeDeclare(...);
channel.QueueDeclare(...);
channel.QueueBind(...);
works perfectly.
However, infrastructure configuration embedded in application code creates several challenges:
- duplication;
- difficult environment management;
- reduced portability;
- harder testing.
Descriptors solve these issues by providing a declarative model.
graph LR
Descriptor --> Publisher
Descriptor --> Subscriber
Publisher --> RabbitMQ
Subscriber --> RabbitMQ
Why ExchangeBoundDescriptor?¶
RabbitMQ topologies frequently contain more than simple exchange-to-queue bindings.
Examples include:
Exchange -> Queue
Exchange -> Exchange
Exchange -> N Queues
Exchange -> N Exchanges
ExchangeBoundDescriptor provides a single abstraction capable of representing all these scenarios.
Why Routing Bridge?¶
Routing logic should not be scattered throughout application code.
The framework provides routing abstractions that allow routing behavior to be configured rather than hardcoded.
Benefits include:
- centralized routing;
- easier maintenance;
- environment-specific routing.
Why Formatter Abstraction?¶
Serialization technologies evolve independently from transport technologies.
Applications should be able to switch between:
- System.Text.Json
- Newtonsoft.Json
- custom formatters
without changing messaging infrastructure.
Why ASP.NET Core Integration?¶
Some integration scenarios naturally follow a request/response model.
Instead of building a separate RPC framework, ServiceBus.AspNetCore.Rabbit extends the messaging infrastructure and allows ASP.NET Core endpoints to process requests arriving from RabbitMQ.
graph LR
Client --> RabbitMQ
RabbitMQ --> ASPNET["ASP.NET Core"]
ASPNET --> Controller