Azure Service Bus

Use Nimbus with Azure Service Bus for managed cloud messaging

Azure Service Bus is Microsoft’s fully managed cloud messaging service. It’s the recommended transport for production deployments on Azure — no infrastructure to operate, 99.9%+ SLA, and built-in enterprise features like scheduled messages, dead-lettering, sessions, and geo-redundancy.

Installation

dotnet add package Nimbus.AzureServiceBus

Quick Start

Get Your Connection String

  1. In the Azure Portal, navigate to your Service Bus namespace
  2. Go to Settings → Shared access policies
  3. Select RootManageSharedAccessKey and copy the Primary Connection String

Configure Nimbus

using Nimbus;
using Nimbus.Configuration;

var bus = new BusBuilder()
    .Configure()
    .WithNames("OrderService", Environment.MachineName)
    .WithTransport(new AzureServiceBusTransportConfiguration()
        .WithConnectionString(connectionString))
    .WithTypesFrom(typeProvider)
    .WithAutofacDefaults(container)
    .Build();

await bus.Start();

Avoid storing connection strings by using a managed identity instead. Grant the Azure Service Bus Data Owner role to your managed identity, then:

new AzureServiceBusTransportConfiguration()
    .WithNamespaceEndpoint("your-namespace.servicebus.windows.net")
    .WithManagedIdentity()

Large Messages

Messages exceeding the size limit (256 KB on Standard, 1 MB on Premium) can be offloaded to blob storage:

new AzureServiceBusTransportConfiguration()
    .WithConnectionString(connectionString)
    .WithLargeMessageBodyStore(
        new AzureBlobStorageLargeMessageBodyStore(
            storageConnectionString,
            containerName: "nimbus-large-messages"
        )
    )

See the Large Messages guide for details.