LiteBus
Integrations

Azure Service Bus Transport

Production tier: Beta

LiteBus.Transport.AzureServiceBus provides Azure Service Bus publish and peek-lock consume. LiteBus validates adapters with the official Service Bus emulator in CI; live namespace soak is optional.

Packages to Install

PackageRole
LiteBus.Transport.AzureServiceBusITransportPublisher, AzureServiceBusConsumer, connection options
LiteBus.Inbox.Dispatch.AzureServiceBusInbox processor publish to Service Bus
LiteBus.Outbox.Dispatch.AzureServiceBusOutbox processor publish to Service Bus
LiteBus.Inbox.Ingress.AzureServiceBusService Bus intake into IInbox.AcceptAsync

Registration

var transportOptions = new AzureServiceBusTransportOptions
{
    ConnectionString = configuration["ServiceBus:ConnectionString"]!,
    ConnectivityCheckTarget = new AzureServiceBusQueueDiagnosticTarget("orders-ingress")
};

builder.AddAzureServiceBusTransport(transportOptions);
builder.AddMessaging(_ => { });
builder.AddInbox(inbox =>
{
    inbox.Contracts.Register<ShipOrderCommand>("orders.commands.ship", 1);
    inbox.UseInMemoryStorage();
    inbox.UseAzureServiceBusDispatch(_ => { });
    inbox.UseAzureServiceBusIngress(ingress =>
    {
        ingress.UseOptions(new AzureServiceBusInboxIngressOptions
        {
            Destination = "orders-ingress",
            PrefetchCount = 10,
            MaxConcurrentCalls = 4,
            RequeueOnFailure = true
        });
    });
});

Options Reference

TypePropertyDefaultNotes
AzureServiceBusTransportOptionsConnectionStringrequiredNamespace or emulator connection
ConnectivityCheckTargetnullQueue or topic subscription peeked for readiness; missing reports degraded
ConsumerErrorRetryInterval5 sProcessor restart backoff initial
ConsumerErrorRetryMaxInterval60 sProcessor restart backoff cap
AzureServiceBusInboxIngressOptionsRequeueOnFailuretrueAbandon vs complete on failure
PrefetchCount0Messages eagerly cached by the Azure client
MaxConcurrentCallsSDK default 1Azure processor callback concurrency
Safety.MaxInFlightMessages32Final LiteBus handler admission cap

Azure defines PrefetchCount and MaxConcurrentCalls as separate processor settings. Keep the prefetch cache large enough to feed the requested callback concurrency, then use Safety.MaxInFlightMessages when LiteBus work needs a lower bound. See Microsoft's Service Bus prefetch guidance.

The root transport registers transport.azure_service_bus.connectivity. Configure an AzureServiceBusQueueDiagnosticTarget or AzureServiceBusSubscriptionDiagnosticTarget and grant listen permission on that entity. The probe uses PeekMessagesAsync, which reads without locking or settling a message. Without a target, health reports degraded because constructing ServiceBusClient does not open a broker connection.

Guarantees and Non-Guarantees

GuaranteedNot guaranteed
At-least-once when CompleteMessage follows successful acceptExactly-once processing without idempotency
AbandonMessage on ReturnToQueueAsyncFIFO ordering unless using sessions explicitly
DeliveryCount > 1 surfaces as TransportMessage.RedeliveredCross-region failover

Handler exceptions propagate to ingress, which applies RequeueOnFailure through ReturnToQueueAsync or DiscardAsync.

Operations

SymptomAction
Messages stuck in peek-lockInspect accept failures; verify processor and store health
Emulator tests skipStart Docker; see Integration tests
Repeated redeliveryConfirm idempotency keys on ingress metadata
transport.azure_service_bus.connectivity degradedConnectivityCheckTarget is missing

Tests

ScenarioLocation
Ingress end-to-endAzureServiceBusInboxIngressEndToEndIntegrationTests
Poison and unknown contract drainAzureServiceBusInboxIngressFailureIntegrationTests
Requeue on transient failureAzureServiceBusIngressRequeueBehaviorIntegrationTests

On this page