ID : dispatch.transport-core
Name : Shared transport dispatchers
Maturity : GA
Summary : Broker-neutral TransportInboxDispatcher and TransportOutboxDispatcher publish leased envelopes through ITransportPublisher with shared options and optional tenant routing.
LiteBus.Inbox.Dispatch and LiteBus.Outbox.Dispatch host the shared transport dispatch implementation. Each dispatcher resolves the contract from the envelope, optionally decrypts the payload, optionally validates deserialization, resolves a transport route, builds publish headers, and calls ITransportPublisher.PublishAsync.
TransportInboxDispatchModule and TransportOutboxDispatchModule register the dispatcher and require a matching root transport module. Broker-specific Use*Dispatch extensions contribute only feature bridge wiring. Transport outbox modules expose DefaultHookFailurePolicy = CompleteDespiteHookFailure.
Route resolution order:
Axis Priority Inbox ITenantRoutingStrategy if registered, else ResolveRoute delegate, else ContractNameOutbox ITenantRoutingStrategy if registered, else non-empty Topic, else ResolveRoute delegate, else ContractName
Package Role LiteBus.Inbox.DispatchInbox transport dispatcher and module LiteBus.Outbox.DispatchOutbox transport dispatcher and module LiteBus.Transport.AbstractionsITransportPublisher, TransportPublishRequestLiteBus.TransportTracing, shared header helpers LiteBus.MessagingPayload protection, serializer integration
runtime.contract-registry (contract name/version to CLR type)
runtime.message-serialization
Matching root transport.* broker module registered through Add*Transport(...)
dispatch.registration
Stored payload bytes are published as-is after optional unprotect; deserialization is for validation only when ValidatePayloadBeforeDispatch is true.
MessageId on the transport request is the envelope GUID string.
One explicitly selected root transport module is shared by dispatch and ingress.
Dispatch throws on transport failure; the processor owns retry and dead-letter state.
Does not consume from brokers (ingress axis owns intake).
Does not deserialize and invoke mediators (in-process dispatch owns that path).
Does not persist terminal store outcomes (processor owns persistence after dispatch returns).
bus. AddKafkaTransport ( new KafkaTransportOptions { BootstrapServers = "localhost:9092" });
bus. AddOutbox ( outbox => outbox. UseKafkaDispatch (
options =>
{
options.DefaultDestination = "orders.events" ;
options.ValidatePayloadBeforeDispatch = true ;
options.ResolveRoute = envelope => envelope.Topic ?? envelope.ContractName;
}));
Package LiteBus.Inbox.DispatchImplements IInboxDispatcher.DispatchAsyncFlow Resolve contract to unprotect payload to optional deserialize validation to resolve route to start publish activity to ITransportPublisher.PublishAsync
Throws when contract resolution, validation, or transport publish fails. Does not catch transport exceptions.
Package LiteBus.Outbox.DispatchImplements IOutboxDispatcher.DispatchAsyncFlow Same as inbox transport dispatcher; route prefers envelope Topic before resolver and contract name
Package LiteBus.Inbox.DispatchRegisters TransportInboxDispatcherOptions singleton, IInboxDispatcher to TransportInboxDispatcherDependencies Requires the matching root transport module; duplicate dispatcher registration fails during composition
Package LiteBus.Outbox.DispatchRegisters TransportOutboxDispatcherOptions singleton, IOutboxDispatcher to TransportOutboxDispatcherDefaultHookFailurePolicyCompleteDespiteHookFailure (transport outbox default)
Property Default Role DefaultDestination""Exchange, topic, queue URL, or InMemory destination name ContentTypeapplication/jsonWire MIME type PersistenttrueBroker durability flag (AMQP) MandatoryfalseFail publish when unroutable (AMQP) ResolveRoutenullPer-envelope route override delegate ValidatePayloadBeforeDispatchfalseDeserialize before publish to catch contract wiring errors
Type Role IInboxPayloadProtector / IOutboxPayloadProtectorDecrypt stored payload before publish ITenantRoutingStrategyPer-tenant destination/route override
Signal Constant / name Tags / attributes When Send activity send {destination}Activity source LiteBus.Transport; required messaging operation tags plus destination, message id, conversation id, and broker-specific route tags Started by the concrete transport publisher around its SDK send call Processor dispatch duration litebus.inbox.processor.dispatch_duration / litebus.outbox.processor.dispatch_durationHistogram in ms Processor envelope handler wraps dispatch (includes transport and in-process paths) Circuit breaker open litebus.transport.circuit_breaker.openTag litebus.transport.broker (amqp, kafka, sqs, azure_service_bus, inmemory) Broker adapter records consecutive publish/connection failures Circuit breaker failure count litebus.transport.circuit_breaker.failure_countSame broker tag Incremented on counted publish failures Processor pass counters litebus.inbox.processor.succeeded / failed / dead_lettered; litebus.outbox.processor.published / failed / dead_letteredNone on dispatch axis Incremented after dispatch outcome is persisted
Trace context from envelope headers is copied onto TransportPublishRequest.Headers for downstream process {destination} correlation. No dispatch-specific meter exists beyond processor and transport layers.
Register transport tracing through AddLiteBusTransportInstrumentation() from LiteBus.Transport.Extensions.OpenTelemetry. Processor metrics require AddLiteBusInboxMetrics() / AddLiteBusOutboxMetrics().
Test method Project DispatchAsync_ShouldPublishEnvelopeThroughTransportLiteBus.Inbox.UnitTests (Dispatch/)ProcessPendingAsync_ShouldPublishLeasedEnvelopeToKafkaTopicLiteBus.Durable.IntegrationTests (Dispatch/Inbox/Kafka/)ProcessPendingAsync_ShouldPublishLeasedEnvelopeToSqsQueueLiteBus.Durable.IntegrationTests (Dispatch/Inbox/AwsSqs/)ProcessPendingAsync_ShouldPublishLeasedEnvelopeToInMemoryDestinationLiteBus.Durable.IntegrationTests (Dispatch/Inbox/InMemory/)ProcessPendingAsync_ShouldPublishLeasedEnvelopeToServiceBusQueueLiteBus.Durable.IntegrationTests (Dispatch/Inbox/AzureServiceBus/)ProcessPendingAsync_ShouldPublishLeasedEnvelopeToAmqpQueueLiteBus.Durable.IntegrationTests (Dispatch/Inbox/Amqp/)ProcessPendingAsync_ShouldPublishToAmqpAndMarkPostgreSqlEnvelopeCompletedLiteBus.Durable.IntegrationTests (Dispatch/Inbox/Amqp/)DispatchAsync_ShouldPublishEnvelopeThroughTransportLiteBus.Outbox.UnitTests (Dispatch/)DispatchAsync_when_validate_payload_disabled_should_publish_without_deserializingLiteBus.Outbox.UnitTests (Dispatch/)DispatchAsync_when_validate_payload_enabled_should_throw_before_publishLiteBus.Outbox.UnitTests (Dispatch/)ProcessPendingAsync_ShouldPublishEnvelopeToKafkaTopicLiteBus.Durable.IntegrationTests (Dispatch/Outbox/Kafka/)ProcessPendingAsync_WhenTopicMissing_ShouldUseContractNameAsRouteLiteBus.Durable.IntegrationTests (Dispatch/Outbox/Kafka/, Dispatch/Outbox/AwsSqs/, Dispatch/Outbox/InMemory/, Dispatch/Outbox/AzureServiceBus/)ProcessPendingAsync_WhenBrokerUnreachable_ShouldMarkFailedWithVisibleAfterLiteBus.Durable.IntegrationTests (Dispatch/Outbox/Kafka/, Dispatch/Outbox/AwsSqs/)ProcessPendingAsync_WhenCircuitBreakerOpen_ShouldNotPublishLiteBus.Durable.IntegrationTests (Dispatch/Outbox/Kafka/, Dispatch/Outbox/AwsSqs/)ProcessPendingAsync_ShouldPublishEnvelopeToAmqpQueueLiteBus.Durable.IntegrationTests (Dispatch/Outbox/Amqp/)ProcessPendingAsync_ShouldPublishEnvelopeToInMemoryDestinationLiteBus.Durable.IntegrationTests (Dispatch/Outbox/InMemory/)InboxDispatchExtensions_ShouldRegisterTransportDispatcherLiteBus.Durable.IntegrationTests (Registration/)OutboxDispatchExtensions_ShouldRegisterTransportDispatcherLiteBus.Durable.IntegrationTests (Registration/)UseAmqpDispatch_WithAmqpTransportModule_ShouldRegisterTransportOutboxDispatcherLiteBus.Durable.IntegrationTests (Dispatch/Outbox/Amqp/)
Inbox ValidatePayloadBeforeDispatch = true branch.
ITenantRoutingStrategy route selection on inbox and outbox paths.
Payload decryption branch for both dispatchers.
AMQP and Azure outbox unreachable-broker coverage parity.
Broker consumption (ingress axis)
Deserializing and invoking in-process mediators (in-process dispatch axis)
Persisting terminal store outcomes after dispatch returns (processor and storage axes)