RabbitMQ and Managed Queues (SQS, Pub/Sub)
Use a classic broker with routing, per-message acks and delays, or a managed cloud queue, when you need task distribution rather than a replayable log.
Intermediate · about 4 hours · difficulty 3/5
Learn first: Message Queues and Async Processing
If your main need is distributing tasks to workers rather than keeping a replayable event history, a classic message broker or a managed queue is simpler than Kafka.
RabbitMQ
- Producers publish to exchanges; exchanges route to queues by rules:
- Direct: exact routing key match.
- Topic: wildcard patterns such as order.*.created.
- Fanout: copy to every bound queue.
- Per-message acks, prefetch limits to stop one worker hogging messages, TTLs, dead-letter exchanges and priority queues.
- Messages are removed once acked, so there is no replay by default (RabbitMQ Streams add log-like behaviour).
Managed cloud queues
- Amazon SQS: fully managed, scales without capacity planning. Standard queues give at-least-once delivery with best-effort order; FIFO queues give ordering per message group and deduplication with lower throughput.
- Google Pub/Sub and Azure Service Bus: similar managed options with pub/sub fan-out.
- Pair SQS with SNS for fan-out to multiple queues.
Choosing between them and Kafka
- Task queue with retries, delays and priorities, modest volume: RabbitMQ or SQS.
- High-volume event stream, many consumers, replay needed: Kafka.
- Small team on AWS who wants zero ops: SQS plus SNS.
Pitfalls
- Unbounded prefetch, so one slow consumer holds thousands of unacked messages.
- Assuming SQS standard queues deliver exactly once or in order.
- Running a self-managed broker cluster with no monitoring of queue depth and memory alarms.
You are ready to move on when you can set up a topic exchange that routes order events to three different worker queues and explain when you would pick SQS FIFO over a standard queue.
Key concepts
- Exchanges, queues and bindings
- Direct, topic and fanout exchanges
- Prefetch and acks
- Dead-letter exchanges
- SQS standard vs FIFO
- SNS + SQS fan-out
Other options for this step
- Event Streaming with Kafka: Learn the log-based model behind Kafka: topics, partitions, offsets and consumer groups, and when a durable event stream beats a classic queue.
Mini project
Build an order processing demo on RabbitMQ with a topic exchange routing to invoice, email and analytics queues, prefetch of 10, and a dead-letter exchange. Show what happens when the invoice worker throws for one specific order.
Check yourself
Why does RabbitMQ not let a new consumer replay last week's messages, while Kafka does?
Free resources
- RabbitMQ tutorials (RabbitMQ)
- RabbitMQ documentation (RabbitMQ)
- Amazon SQS developer guide (AWS)