AMQP · Study deck
AMQP Reliability: Persistence and Routing Patterns
The dangerous AMQP mistakes are often quiet.
Broker Bex is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Diagnose Common AMQP Pitfalls: Analyze the top 5 implementation mistakes that cause data loss and system failures, and explain why each leads to production incidents
- Configure Message Persistence Correctly: Justify why both durable queues AND persistent messages (delivery_mode=2) are required for reliability, and implement both settings together
- Apply Wildcard Patterns Accurately: Distinguish between * (exactly one word) and # (zero or more words) in topic exchanges, and select the correct wildcard for variable-depth routing hierarchies
- Select AMQP vs MQTT Appropriately: Compare protocol overhead metrics (bandwidth, RTT, memory, battery) and justify protocol selection decisions based on quantified device constraints
Major section
In 60 Seconds
A protocol is an agreed set of exchange rules.
- Advanced message queuing protocol (AMQP) is used to exchange messages through named services and rules.
- A broker is a service that accepts messages and routes or stores them for receivers.
- The sender may have retried after a lost reply.
- The service may have redelivered after a worker stopped.
Major section
In 60 Seconds (continued)
Neither event proves that the system is broken; the unsafe part is acting twice without a clear rule.
- One passed path cannot prove exactly-once business action or endless storage.
- It proves the stated exchange under stated limits.
- The deeper sections examine the common myths and show which mechanism, record, and application rule can support a narrower claim.
Major section
The "It Should Work" Trap
"I set my queue to durable, so my messages will survive a server restart, right?" Sammy the Sensor said confidently.
- My light readings vanished when the server rebooted." Max nodded. "Another common one: people think more consumers always means faster processing.
Major section
The Pitfall
For constrained devices (battery, bandwidth), MQTT is often superior.
- In this 10,000-message example, the protocol-overhead row uses 2 bytes for MQTT and 8–20 bytes for AMQP, so MQTT carries less framing.
- The resulting totals are 2.02 MB and 2.18 MB respectively, again favoring MQTT for this payload mix.
Major section
Try It: Duplicate Message Simulator
Adjust the number of commands, glitch probability, and see how idempotency keys prevent dangerous duplicate executions in a chemical tank filling scenario.
- Simulate what happens when network glitches cause message redelivery.
Deck summary
Key takeaways
A protocol is an agreed set of exchange rules.
- Neither event proves that the system is broken; the unsafe part is acting twice without a clear rule.
- "I set my queue to durable, so my messages will survive a server restart, right?" Sammy the Sensor said confidently.
- For constrained devices (battery, bandwidth), MQTT is often superior.
- Adjust the number of commands, glitch probability, and see how idempotency keys prevent dangerous duplicate executions in a chemical tank filling scenario.
Retrieval practice
Recall check 1 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q1Per this chapter's persistence truth table, what happens to a queue declared with durable=True but messages published with delivery_mode=1 (transient), after a broker restart?
Show answer
Answer: A see answers page
Retrieval practice
Recall check 2 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q2Per this chapter's Misconception 2 impact data, what happened to a smart building system that used sensor.temperature.* instead of sensor.temperature.#?
Show answer
Answer: A
Retrieval practice
Recall check 3 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q3A payment processing consumer uses auto_ack=True and processes each message in 20ms on average. The consumer crashes while processing message #50 out of 200 total messages. How many messages are permanently lost?
Show answer
Answer: B With auto_ack, the broker removes a message from the queue the instant it delivers it - before the consumer processes it.
Retrieval practice
Recall check 4 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q4Per this chapter's chemical-tank duplicate scenario, why does the command execute twice (tank fills by 200ml instead of the intended 100ml) even though the first execution succeeded?
Show answer
Answer: A This is the chapter's concrete illustration of at-least-once delivery's redelivery mechanism: the broker only knows a message is 'done' when it receives an ACK.
Print reference
Answers 1 of 2
Answer key.
- A · The chapter's four-row truth table shows durable=True, delivery_mode=1 as the 'TRAP' configuration (per the Try It tool's label): the queue definition exists after restart, but every transient message it held is gone, so the queue simply comes back empty.
- A
- B · With auto_ack, the broker removes a message from the queue the instant it delivers it - before the consumer processes it.
Print reference
Answers 2 of 2
Answer key.
- A · This is the chapter's concrete illustration of at-least-once delivery's redelivery mechanism: the broker only knows a message is 'done' when it receives an ACK.