AMQP · Study deck
AMQP Reliability: Delivery Controls
Some messages are casual status updates, and some are smoke alarms.
Broker Bex is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Explain: For a smoke alarm, we need publisher confirms -- the broker texts you back saying 'got it!' If you don't hear back within a few seconds, you send it again.
- Explain: In this serial-latency model, transient messages with an assumed 0.5 ms memory latency reach 2,000 msg/sec—a 20x difference from the assumed 10 ms persistent path.
- Explain: the LED added, "And the fire system uses consumer acknowledgments -- it tells the broker 'message received and acted on' only AFTER it actually starts the sprinklers.
- design an idempotent command with a stable key
Major section
Start With the Decision
A pump may act and lose its application reply, so the sender tries again.
- A broker confirm proves broker acceptance; a consumer acknowledgement reports processing to the broker.
Major section
In 60 Seconds
The sender may try again.
- Reliable delivery then depends on whether the receiver can recognise the same command and keep the physical action bounded.
- AMQP means Advanced Message Queuing Protocol.
- A broker is the service that accepts and routes messages.
- A microcontroller is a small computer built to read inputs and control outputs.
Major section
In 60 Seconds (continued)
Manual acknowledgments prevent message loss during consumer crashes (unlike auto-ack which discards on failure), while dead-letter queues catch rejected or expired messages.
- This runway does not promise exactly-once work.
- AMQP reliability requires configuring both durable queues AND persistent messages -- missing either means data loss on broker restart.
- Key patterns include competing consumers for load distribution and prefetch counts to prevent consumer starvation.
Major section
The Reliability Relay Race
"I sent a smoke alarm message, but the fire system says it never arrived!" Temperature Terry was panicking. "What if there's a real fire?".
- the microcontroller calmed him down. "That's why we use reliability patterns, Sammy.
- For a smoke alarm, we need publisher confirms -- the broker texts you back saying 'got it!' If you don't hear back within a few seconds, you send it again.
- the LED added, "And the fire system uses consumer acknowledgments -- it tells the broker 'message received and acted on' only AFTER it actually starts the sprinklers.
Major section
Interactive: Throughput vs Latency Tradeoff
Key Insight: Disk I/O is the limiting factor for persistent messages.
- A 10 ms disk latency limits throughput to 100 msg/sec per connection.
- In this serial-latency model, transient messages with an assumed 0.5 ms memory latency reach 2,000 msg/sec—a 20x difference from the assumed 10 ms persistent path.
- For high-throughput workloads (>10K msg/sec), either use transient messages or employ broker clustering with message sharding.
Try it: Interactive: Throughput vs Latency Tradeoff in the chapter
Major section
Worked Example: Designing a Multi-Consumer Order Processing System
Scenario: An e-commerce warehouse has 50 robotic picking stations that receive orders from a central system.
- Orders must be distributed evenly across available robots, and each order should be processed exactly once.
- If a robot fails mid-processing, the order must be reassigned.
- Result: Orders are distributed across 50 robots using competing consumers pattern. prefetch_count=1 ensures even distribution regardless of robot speed.
- Dead letter exchange captures orders that exceed TTL or fail repeatedly.
Major section
Interactive: Prefetch Calculator
Key Takeaway: The optimal prefetch count depends on your target latency and processing time.
- For most competing consumer scenarios with variable processing, prefetch=1 is the safest choice.
- Higher prefetch values are only beneficial when processing times are consistent and you need to hide network latency.
Try it: Interactive: Prefetch Calculator in the chapter
Major section
Worked Example: Multi-Tier Alert Routing with Priority Queues
Scenario: A manufacturing plant has sensors monitoring temperature, pressure, and vibration across 10 production lines.
- Result: Critical alerts use persistent delivery with quorum queues for high availability; with publisher confirms and consumer acknowledgements they can survive broker failures, while delivery to on-call engineers still depends on the downstream alert path.
- Warning alerts are persistent but use standard queues.
Major section
Common Misconception: "AMQP Guarantees Message Delivery"
Misconception: Many developers assume that using AMQP automatically guarantees messages will be delivered and processed, leading to data loss in production.
- Reality: AMQP provides mechanisms for reliability, but doesn't enforce them by default.
Deck summary
Key takeaways
A pump may act and lose its application reply, so the sender tries again.
- The sender may try again.
- Manual acknowledgments prevent message loss during consumer crashes (unlike auto-ack which discards on failure), while dead-letter queues catch rejected or expired messages.
- "I sent a smoke alarm message, but the fire system says it never arrived!" Temperature Terry was panicking. "What if there's a real fire?".
- Key Insight: Disk I/O is the limiting factor for persistent messages.
Retrieval practice
Recall check 1 of 3

Broker Bex says: answer from memory, then check your reasoning.
Q1A poison job keeps failing in a worker. Which queue plan keeps it for review without an endless retry loop?
Show answer
Answer: C A bounded route preserves the failed job for investigation.
Retrieval practice
Recall check 2 of 3

Broker Bex says: answer from memory, then check your reasoning.
Q2A consumer receives an AMQP message representing a payment transaction. It calls basic_nack(delivery_tag=tag, requeue=False). Where does the message go next?
Show answer
Answer: B basic_nack(requeue=False) routes the message to the dead-letter exchange if configured, or drops it.
Retrieval practice
Recall check 3 of 3

Broker Bex says: answer from memory, then check your reasoning.
Q3One slow worker holds many unacked jobs while other workers wait. What change should be tested?
Show answer
Answer: B A lower limit can stop one worker from hoarding work.
Print reference
Answers
Answer key.
- C · A bounded route preserves the failed job for investigation.
- B · basic_nack(requeue=False) routes the message to the dead-letter exchange if configured, or drops it.
- B · A lower limit can stop one worker from hoarding work.