Interface IRoutingBuilder
Fluent builder interface for configuring message routing in the Excalibur framework.
public interface IRoutingBuilder
- Extension Methods
Examples
services.AddDispatch(dispatch =>
{
dispatch.UseRouting(routing =>
{
routing.Transport
.Route<OrderCreated>().To("rabbitmq")
.Route<PaymentProcessed>().To("kafka")
.Default("local");
routing.Endpoints
.Route<OrderCreated>()
.To("billing-service", "inventory-service")
.When(msg => msg.Amount > 1000).AlsoTo("fraud-detection");
routing.Fallback.To("dead-letter-queue");
});
});
Remarks
This builder provides a unified entry point for configuring both transport selection (which message bus to use) and endpoint routing (which services receive messages).
The two-tier routing architecture separates concerns:
Properties
Endpoints
Gets the endpoint routing builder for configuring service routing rules.
IEndpointRoutingBuilder Endpoints { get; }
Property Value
- IEndpointRoutingBuilder
A builder for defining endpoint routing rules that determine which services receive each message type.
Fallback
Gets the fallback routing builder for configuring fallback behavior.
IFallbackRoutingBuilder Fallback { get; }
Property Value
- IFallbackRoutingBuilder
A builder for defining fallback routes when no rules match.
Transport
Gets the transport routing builder for configuring message bus selection rules.
ITransportRoutingBuilder Transport { get; }
Property Value
- ITransportRoutingBuilder
A builder for defining transport routing rules that determine which message bus handles each message type.