ID : dispatch.inbox.amqp
Name : Inbox AMQP dispatch
Maturity : GA
Summary : Publishes leased inbox envelopes to RabbitMQ or LavinMQ through TransportInboxDispatcher and AmqpTransportModule.
AddAmqpTransport(...) registers the horizontal AMQP infrastructure once at the root. InboxModuleBuilder.UseAmqpDispatch(...) wires only TransportInboxDispatchModule, which requires that root module. The inbox processor keeps the durable lease and retry behavior, but the dispatch step publishes to AMQP instead of calling local command handlers.
Common deployment shape is a producer service with inbox storage and processor enabled, plus a separate worker service that consumes the queue and accepts into its own inbox. Because the processor acknowledges completion only after store persist, this path is at-least-once.
services. AddLiteBus ( litebus =>
{
litebus. AddAmqpTransport ( new AmqpConnectionOptions
{
HostName = "localhost" ,
Port = 5672 ,
VirtualHost = "/" ,
UserName = "guest" ,
Password = "guest"
});
litebus. AddInbox ( inbox =>
{
inbox. EnableInboxProcessor ();
inbox. UseAmqpDispatch (
options =>
{
options.DefaultDestination = "commands.exchange" ;
options.ResolveRoute = envelope => envelope.ContractName;
options.Persistent = true ;
options.Mandatory = true ;
});
});
});
API Role InboxModuleBuilder.UseAmqpDispatch(Action<TransportInboxDispatcherOptions>)Registers transport inbox dispatcher that requires the root AMQP transport TransportInboxDispatcher.DispatchAsync(InboxEnvelope, CancellationToken)Resolves route, maps headers, publishes through ITransportPublisher
TransportInboxDispatcherOptions:
Property Default Role DefaultDestination""Exchange name ("" targets default direct exchange) ContentTypeapplication/jsonMIME value written to publish request PersistenttrueRequests broker-persistent delivery MandatoryfalseFails publish when message is unroutable ResolveRoutenullRoute override delegate per envelope ValidatePayloadBeforeDispatchfalseDeserializes payload before publish to detect contract mismatch
AmqpConnectionOptions:
Property Default Role UrinullFull AMQP URI, overrides host/port/credentials when set HostNamelocalhostBroker host name Port5672Broker port VirtualHost/AMQP virtual host UserName / Passwordguest / guestBroker credentials ClientProvidedNamenullConnection display name in broker UI AutomaticRecoveryEnabledtrueEnables RabbitMQ client reconnect NetworkRecoveryInterval00:00:05Delay between reconnect attempts CircuitBreakerconfigured object Separate connection and per-exchange publisher breaker thresholds
Package Role LiteBus.Inbox.Dispatch.AmqpInbox AMQP registration extension LiteBus.Inbox.DispatchShared transport inbox dispatcher LiteBus.Transport.AmqpAMQP transport adapter and OpenTelemetry registration
dispatch.registration
dispatch.transport-core
transport.amqp
durable-core.inbox
Only one IInboxDispatcher can be registered in an inbox module builder scope.
TransportInboxDispatchModule throws at compose time when no ITransportPublisher is registered.
Route resolution order is tenant strategy, then ResolveRoute, then ContractName.
Processor semantics remain at-least-once, AMQP publish success alone does not mark completion.
AMQP queue consumption and accept semantics (handled by ingress.amqp).
Combining in-process and AMQP dispatch on the same inbox module.
Broker-side queue topology management beyond publishing to configured destination and route.
Signal Name Tags Activity send {destination}messaging.destination.name, messaging.rabbitmq.destination.routing_key, messaging.message.idCounter litebus.transport.circuit_breaker.openlitebus.transport.broker=amqpCounter litebus.transport.circuit_breaker.failure_countlitebus.transport.broker=amqpHistogram litebus.inbox.processor.dispatch_durationprocessor tags Counters litebus.inbox.processor.succeeded / failed / dead_letteredprocessor tags
Register transport signals with AddLiteBusAmqpMetrics() and processor signals with AddLiteBusInboxMetrics().
Test method Project InboxDispatchExtensions_ShouldRegisterTransportDispatcherLiteBus.Durable.IntegrationTests (Registration/)ProcessPendingAsync_ShouldPublishLeasedEnvelopeToAmqpQueueLiteBus.Durable.IntegrationTests (Dispatch/Inbox/Amqp/)ProcessPendingAsync_ShouldPublishToAmqpAndMarkPostgreSqlEnvelopeCompletedLiteBus.Durable.IntegrationTests (Dispatch/Inbox/Amqp/)
Explicit inbox dispatch failure path when broker is unreachable.
Mandatory = true unroutable publish behavior in integration tests.
Custom route resolver and tenant routing strategy branches.
Queue consumer ack and retry semantics.
Exchange and binding provisioning lifecycle.