Skip to content
  1. Blog
  2. Learning

Azure Service Bus vs. RabbitMQ: Practical Guidance for Reliable .NET Messaging

TL;DR: Pick Azure Service Bus when you want a managed broker with dead-letter queues and duplicate detection built in. Pick RabbitMQ when you need flexible routing or want to run the broker yourself. Either way, design for repeats and retries, as you would for events from our eSignature API.

Your .NET (Microsoft’s developer platform) app sends an order, a payment or a signed contract to another service. When that service is slow or down, a direct call fails and the work is lost. A message broker holds the work in a queue until the other side is ready.

This guide compares the two brokers .NET teams ask about most. It covers how each one handles delivery, failures and hosting, then shows working consumer code for both.

Azure Service Bus vs RabbitMQ: what is the difference?

Azure Service Bus is a message broker that Microsoft runs for you in Azure. RabbitMQ is an open-source broker that you install, run and upgrade yourself.

Think of two ways to handle mail at an office. Service Bus is like paying a post office to sort and hold your letters. RabbitMQ is like running your own mail room, where you set every sorting rule but also staff the room.

Microsoft describes Service Bus as a fully managed enterprise message broker with queues and publish and subscribe topics. RabbitMQ routes messages through exchanges and bindings, as its Advanced Message Queuing Protocol (AMQP) 0-9-1 model guide explains.

Why does a .NET app need a message broker?

A broker lets two services trade work without both being online at the same moment. Microsoft calls this temporal decoupling: messages are stored durably in the queue, so the sender does not wait.

Without a broker, services talk through direct web requests. A traffic spike or a slow service then spreads failure along the chain. A broker helps you:

  • Absorb bursts of work without dropping requests.
  • Deploy senders and receivers on their own schedules.
  • Add more consumers when the queue grows, without touching the sender.

How do RabbitMQ vs Azure Service Bus compare in production?

The biggest gap is who runs the broker. Service Bus hands hosting to Microsoft, while RabbitMQ gives you full control and full responsibility.

Area Azure Service Bus RabbitMQ
Core model Queues, topics and subscriptions Exchanges, queues and bindings
Delivery Receive and delete (at most once) or peek lock (at least once) Manual or automatic acknowledgements
Failed messages Built-in dead-letter queue on each queue and subscription Dead letter exchanges you set up with policies
Duplicates Duplicate detection by message ID on Standard and Premium tiers Handled in your consumer code
High availability Managed by Microsoft Quorum queues replicated across your cluster
Running it Microsoft hosts and patches the service You run nodes, upgrades and capacity
Fits Azure-first teams that want less to operate Complex routing, hybrid or on-premises setups

Both brokers usually end up with at-least-once delivery. Plan for duplicates as a normal event, because Service Bus redelivers a message when a consumer crashes before completing it.

How do queues and topics work in Azure Service Bus?

A queue sends each message to one consumer. A topic sends a copy of each message to every subscription.

Azure Service Bus queues

Queues offer first in, first out (FIFO) delivery to one or more competing consumers. Several workers can read from one queue, and each message goes to a single worker.

Azure Service Bus topics and subscriptions

Topics support publish and subscribe. Each subscription works like its own virtual queue that receives copies of the messages sent to the topic.

Receive and delete vs peek lock

Service Bus gives you two ways to receive a message:

  • In receive and delete mode, the message is marked consumed at once, so a crash mid-task loses it.
  • In peek lock mode, the message stays locked while you work and comes back if you abandon it.
  • A peek lock message also unlocks for redelivery when the lock expires before you finish.

How do exchanges, queues and bindings work in RabbitMQ?

RabbitMQ sends every message to an exchange first. The exchange then routes it into zero or more queues, based on its type and its bindings.

  • Exchanges come in four types: direct, fanout, topic and headers.
  • Queues hold messages until a consumer takes them.
  • Acknowledgements such as basic.ack, basic.nack and basic.reject tell the broker how a delivery went.

RabbitMQ suits a design where one message needs different routes based on its headers or routing key. Its acknowledgement guide calls automatic acknowledgement unsafe, because a message is lost when the channel closes first.

What does Azure RabbitMQ hosting involve?

Running RabbitMQ in Azure means you host the broker on servers or containers that you manage. You own the cluster, its upgrades, its disk and memory alarms and its network.

A RabbitMQ Azure deployment also needs the right queue type. RabbitMQ’s quorum queues guide calls them the default choice for a replicated, highly available queue. They use the Raft consensus algorithm, and classic queue mirroring was removed in RabbitMQ 4.0.

With Service Bus, your work shifts to the app side:

  • Client settings, retry rules and monitoring.
  • Queue, topic and subscription design.
  • Choosing a tier that fits your load and budget.

How do you migrate RabbitMQ to Azure Service Bus?

Start by bridging the two brokers, then move consumers over one queue at a time. Microsoft’s RabbitMQ Service Bus integration guide forwards messages with the Shovel plugin that ships with RabbitMQ.

Service Bus speaks AMQP 1.0, an open standard. Microsoft notes that this lets you write apps that work against Service Bus and on-premises brokers such as RabbitMQ.

Keep your code ready for a move like this. Wrap the broker behind your own messaging interface, and keep message formats stable.

Which patterns does every broker need?

Neither broker promises exactly-once processing. Your consumers must cope with duplicates, retries and partial failures.

How do idempotent consumers stop duplicates from breaking your system?

An idempotent consumer gives the same result when it handles a message twice. You can build one in three ways:

  • Use a business key, such as an order ID and event type, to spot repeats.
  • Keep a record of handled message IDs, or rely on a unique database key.
  • Make side effects safe to repeat, for example an upsert in place of an insert.

Service Bus duplicate detection helps too. It tracks message IDs for a window of 20 seconds to 7 days, 10 minutes by default. Long workflows can still repeat outside that window, so keep the consumer idempotent.

How do you stop retry storms?

A retry storm happens when many consumers retry a failing task at once. Keep the load under control with these steps:

  • Retry with exponential backoff on the client.
  • Cap how many messages each consumer handles at the same time.
  • Move a message that keeps failing to a dead-letter queue (DLQ) early.

Each Service Bus queue and subscription has its own dead-letter queue for messages that cannot be processed. RabbitMQ uses dead letter exchanges for rejected, expired or overflow messages.

How do you run an Azure Service Bus consumer in a .NET app?

Run the consumer as a background service, outside your controllers and request pipeline. It then starts with the app, stops cleanly on shutdown and keeps working whatever the web traffic does.

Microsoft’s guide to hosted services in ASP.NET Core shows background tasks built on IHostedService and BackgroundService. The steps below use ServiceBusProcessor from the official Azure.Messaging.ServiceBus package.

  1. Install the Azure.Messaging.ServiceBus package.
  2. Register one ServiceBusClient as a singleton.
// Program.cs
builder.Services.AddSingleton(_ =>
    new Azure.Messaging.ServiceBus.ServiceBusClient(
        builder.Configuration.GetConnectionString("ServiceBus")));
  1. Write a hosted consumer.
using Azure.Messaging.ServiceBus;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

public sealed class OrdersConsumer : BackgroundService
{
    private readonly ServiceBusClient _client;
    private readonly ILogger<OrdersConsumer> _logger;
    private ServiceBusProcessor? _processor;

    public OrdersConsumer(ServiceBusClient client, ILogger<OrdersConsumer> logger)
    {
        _client = client;
        _logger = logger;
    }

    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        // Queue OR Topic+Subscription processor (use CreateProcessor(topic, subscription) for pub/sub)
        _processor = _client.CreateProcessor("orders", new ServiceBusProcessorOptions
        {
            AutoCompleteMessages = false,
            MaxConcurrentCalls = 8 // tune based on your workload
        });

        _processor.ProcessMessageAsync += HandleMessage;
        _processor.ProcessErrorAsync += HandleError;

        await _processor.StartProcessingAsync(stoppingToken);

        // Keep the hosted service alive until shutdown
        await Task.Delay(Timeout.InfiniteTimeSpan, stoppingToken);
    }

    private async Task HandleMessage(ProcessMessageEventArgs args)
    {
        try
        {
            var body = args.Message.Body.ToString();

            // TODO: Your idempotent business processing here

            await args.CompleteMessageAsync(args.Message);
        }
        catch (Exception ex)
        {
            _logger.LogError(ex, "Failed processing message {MessageId}", args.Message.MessageId);

            // Options: Abandon (retry), Dead-letter, Defer, etc.
            // Dead-lettering is often appropriate for poison messages:
            // await args.DeadLetterMessageAsync(args.Message, "ProcessingFailed", ex.Message);

            await args.AbandonMessageAsync(args.Message);
        }
    }

    private Task HandleError(ProcessErrorEventArgs args)
    {
        _logger.LogError(args.Exception, "Service Bus processor error. Entity: {EntityPath}", args.EntityPath);
        return Task.CompletedTask;
    }

    public override async Task StopAsync(CancellationToken cancellationToken)
    {
        if (_processor is not null)
        {
            await _processor.StopProcessingAsync(cancellationToken);
            await _processor.DisposeAsync();
        }
        await base.StopAsync(cancellationToken);
    }
}
  1. Register the hosted service.
builder.Services.AddHostedService<OrdersConsumer>();

The official Service Bus samples cover sessions, settlement and other advanced cases.

How do you publish and consume RabbitMQ messages in .NET?

Keep RabbitMQ calls inside one messaging layer or hosted service, away from controllers and business logic. Routing, retries and acknowledgements then stay in one place you can test.

The steps below use the RabbitMQ .NET client with manual acknowledgements.

  1. Create a connection and channel.
using RabbitMQ.Client;

var factory = new ConnectionFactory
{
    HostName = "localhost",
    UserName = "guest",
    Password = "guest"
};

using var connection = factory.CreateConnection();
using var channel = connection.CreateModel(); // Some versions use IModel; newer versions expose IChannel.
  1. Declare a durable queue.
channel.QueueDeclare(
    queue: "orders",
    durable: true,
    exclusive: false,
    autoDelete: false,
    arguments: null);
  1. Publish a persistent message.
using System.Text;

var props = channel.CreateBasicProperties();
props.Persistent = true;

var body = Encoding.UTF8.GetBytes("{\"orderId\":\"123\"}");

channel.BasicPublish(
    exchange: "",
    routingKey: "orders",
    basicProperties: props,
    body: body);
  1. Consume with manual acknowledgements.
using RabbitMQ.Client.Events;

channel.BasicQos(prefetchSize: 0, prefetchCount: 20, global: false);

var consumer = new EventingBasicConsumer(channel);
consumer.Received += (sender, ea) =>
{
    try
    {
        var json = Encoding.UTF8.GetString(ea.Body.ToArray());

        // TODO: Idempotent processing here

        channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false);
    }
    catch
    {
        // Requeue = true can cause poison-message loops; decide carefully.
        channel.BasicNack(deliveryTag: ea.DeliveryTag, multiple: false, requeue: false);
    }
};

channel.BasicConsume(
    queue: "orders",
    autoAck: false,
    consumer: consumer);

The client’s method names change between major versions, such as IModel in older releases and IChannel in newer ones. Check the official .NET API guide for the version you install.

How do you keep messages from getting lost or stuck?

Treat your consumers as production services with their own limits and alerts. Problems then show up early, before a backlog builds.

Tune consumers for steady throughput

  • Cap concurrency with MaxConcurrentCalls in Service Bus or a prefetch count in RabbitMQ.
  • Use async calls in handlers, and move heavy computing work to its own worker.
  • Stop pulling new work while a service downstream is unhealthy.

RabbitMQ warns that requeuing on every failure can create a requeue loop. Quorum queues limit this with a delivery limit, which defaults to 20 from RabbitMQ 4.0.

Watch the right numbers

  • Processing time, successes and failures per consumer.
  • Retry counts and dead-letter queue depth.
  • How far consumers lag behind new messages.

Treat the dead-letter queue as work to triage, replay and alert on. Service Bus never clears it on its own, so messages wait there until you act.

Avoid the mistakes behind most outages

  • Assuming exactly-once processing and skipping idempotency.
  • Acknowledging or completing a message before its side effects are done.
  • Requeuing a poison message forever, which creates a hot loop.
  • Spreading broker calls through business code with no messaging boundary.

When should you pick RabbitMQ vs Service Bus?

Pick the broker that matches how your team runs software. Features matter less than who will operate the broker at 2 a.m.

Azure Service Bus tends to fit when you have:

  • Azure-first microservices that need durable queues and topics quickly.
  • Workflows where built-in dead-lettering saves custom code.
  • A small team that wants fewer moving parts to run.

RabbitMQ tends to fit when you have:

  • Complex routing with direct, topic, fanout or headers exchanges.
  • Hybrid or on-premises sites where you need control of the broker.
  • A team with the experience to run a cluster well.

How do BoldSign webhooks fit with a message broker?

A broker is a good home for webhook events. Our webhook endpoint rules say to reply within 10 seconds with a 200 status code, then do heavier work after you reply.

A common setup puts each event from us onto a Service Bus or RabbitMQ queue, then replies at once. A consumer can then process document events such as Completed or Declined at its own pace.

Our webhook lifecycle guide notes that you may get the same event twice after retries or manual resends. Store each event’s unique ID and skip any you have already handled. Our guide to background jobs in .NET shows other ways to run that consumer.

Which BoldSign plan do you need for webhooks and the API?

Webhooks and live API calls need the Enterprise API plan, which starts at $30 a month with 40 envelopes. Each extra envelope costs $0.75, as listed on the BoldSign pricing page in November 2026.

Prices are in USD. Every other plan gives you sandbox access to the API only, and the sandbox is free to use while you build.

Where do you go next with your messaging setup?

Test these patterns against real events before you choose a broker, with retries and duplicates included. For help with an existing setup, visit our support portal.

Frequently asked questions

Does Azure Service Bus deliver each message exactly once?

Peek lock mode gives you at-least-once delivery, so a message can arrive twice after a crash. Duplicate detection drops repeated message IDs within a set time window, but your consumers should still handle repeats safely.

What is the RabbitMQ equivalent in Azure?

Azure Service Bus is the closest match. It is Microsoft's fully managed message broker, with queues for one-to-one work and topics for one-to-many delivery.

Is there an Azure managed RabbitMQ service?

Microsoft's own managed broker in Azure is Azure Service Bus. To keep RabbitMQ, you run and patch it yourself, or bridge it to Service Bus with the RabbitMQ Shovel plugin.

What is the RabbitMQ equivalent of peek lock?

Manual acknowledgements play the same role. Your consumer sends basic.ack after the work is done, and the broker requeues any delivery left unacknowledged when the channel closes.

Should I run message consumers inside my .NET web API app?

You can, as a hosted service that starts and stops with the app. Many teams move consumers to a separate worker app instead, so they can scale and fail on their own.

When should I use Azure Service Bus topics instead of queues?

Use a topic when several services each need their own copy of a message. Use a queue when one worker should handle each message.

Is RabbitMQ one of the Azure Service Bus alternatives?

Yes. RabbitMQ is an open-source broker you can run in Azure, on your own servers or in another cloud. You trade managed hosting for more control over routing and setup.

Which RabbitMQ queue type should I use for high availability?

Use quorum queues. RabbitMQ calls them the default choice for a replicated queue, and classic queue mirroring was removed in RabbitMQ 4.0.

Priya Vinayagam

Priya Vinayagam is a Product Manager at BoldSign and an active full-stack developer at Syncfusion, with four years of hands-on experience across .NET and JavaScript. She writes practical, performance-focused technical articles that help developers tackle real-world challenges. Known for looking beyond the obvious, Priya brings a builder’s mindset to every post—breaking down complex problems into clear, actionable solutions. Connect with her on LinkedIn.

More posts by Priya Vinayagam
Get started

Sign up for your free trial today!

Start free trial
  • 30-day free trial
  • No credit card required