All articles
10 min readUpdated 2026-09-08

A RabbitMQ architecture for notification systems

The short answer

Separate queues per channel so the slowest provider does not set your throughput. Use bounded exponential backoff with a dead-letter queue, and alert on its depth. Store the provider event ID before processing so at-least-once delivery becomes safe. Those three habits remove most notification failures.

Separate what fails differently

Email, SMS and push notifications fail in different ways and at different rates. Putting them on one queue means the slowest, flakiest provider decides your throughput. One queue per channel, and per priority class where it matters, keeps failures contained.

The same logic applies inside a channel. A password reset and a weekly digest are both email, but only one of them has a user staring at an inbox. Separate priority classes cost almost nothing and prevent a bulk send from delaying the message that matters.

Retries need a ceiling and a graveyard

Exponential backoff with a bounded retry count, then a dead-letter queue. A message that cannot be processed must end up somewhere a human can inspect it, not loop forever burning worker capacity.

The dead-letter queue is only useful if someone is alerted on its depth. Monitor it the way you monitor error rate. An unwatched dead-letter queue is just a slower way of dropping messages.

FailureCorrect response
Provider returns 500Retry with backoff; it is probably transient
Provider returns 429Back off using their retry-after header, not your own schedule
Invalid recipient addressDo not retry; dead-letter immediately and flag the record
Malformed messageDead-letter on first failure; retrying cannot fix a payload
Your own bugDead-letter, fix, then replay from the queue

Idempotency is not optional

At-least-once delivery means your consumer will see duplicates. Store the provider event ID before processing and treat a repeat as a no-op. This single habit removes an entire category of production bug.

The ordering matters more than it looks. Record the ID first, in the same transaction as the work, and let a unique constraint reject the duplicate. Checking whether you have seen an ID and then processing is a race with a window wide enough to lose money in.

The topology, concretely

Abstract advice about queues is easy to agree with and hard to act on, so here is the arrangement we actually deploy for a product sending transactional and bulk notifications across three channels.

  1. 01One topic exchange for notifications. Routing keys read channel.priority, for example email.transactional or sms.bulk.
  2. 02One queue per channel and priority pair. Six queues for three channels and two priorities, which is more queues than people expect and still trivially manageable.
  3. 03A separate consumer pool per channel, sized to that provider's throughput rather than to a global average.
  4. 04One retry exchange with a per-queue delay, so a backed-off message leaves the main queue instead of blocking the consumer behind it.
  5. 05One dead-letter queue per channel, never one shared graveyard, because the triage question differs by channel.

The rule underneath all five: anything that can fail independently gets its own queue, and anything that gets its own queue gets its own alert. A queue nobody is alerted on is a place where messages go to be forgotten quietly.

Mistakes we are usually called in to undo

Notification systems fail in a small number of recognisable ways. These five account for most of the incidents we have been asked to diagnose.

  • Retrying inside the consumer. Sleeping and retrying in place holds the connection, blocks the prefetch window, and turns one slow provider into a stalled worker pool. Backoff belongs in the broker, not in your loop.
  • Acknowledging before the work is done. Acknowledging on receipt rather than on success means a crash loses the message silently, which is the failure mode queues exist to prevent.
  • One queue for everything. The bulk digest and the password reset share a queue, and the digest decides how long the reset waits.
  • A dead-letter queue with no alert and no owner. It fills up for six weeks, and by the time anyone looks the messages are too stale to replay.
  • Unbounded prefetch. A consumer claims a thousand messages, then dies holding all of them, and redelivery arrives as a thundering herd against a provider that is already unhappy.

What to monitor

  • Queue depth per channel, because a rising graph is the earliest warning you get.
  • Dead-letter depth, alerted on any sustained increase rather than on a threshold.
  • Consumer lag, because a queue that is draining slowly is a queue that is about to be deep.
  • Per-provider error rate, split from your own error rate, so you know whose outage it is.
  • Time from enqueue to delivery at the 95th percentile, which is what a user experiences.

Related questions

Should each notification channel have its own queue?
Yes. Email, SMS and push fail at different rates and speeds, and a shared queue lets the slowest provider dictate throughput for all of them. Splitting further by priority class is worth it wherever a user is actively waiting on one type of message.
How many times should a failed notification be retried?
Bounded exponential backoff, typically five to seven attempts over a few hours, then dead-letter. The count matters less than having a ceiling: unbounded retries consume worker capacity indefinitely and hide the underlying failure.
How do I stop duplicate notifications being sent?
Store the provider's event ID in the same transaction as the work, protected by a unique constraint. A duplicate delivery then fails the insert and becomes a no-op. Checking first and processing afterwards leaves a race window.

If you want this handled

Or start with the cheapest thing that helps: a $600 consulting session, or a $2,500 codebase assessment whose report is yours either way.

RabbitMQBackendReliability

Two ways to start, both of them cheap.

Book a call and talk it through, or write the problem down and send it — whichever you would actually do today. Either way you get a reply from an engineer within one business day, and an honest answer about whether we are a fit.

Not ready for either? A $600 consulting session buys one straight answer with no obligation to hire us.

Rev. 01Book a call