AMQP · Study deck
AMQP Delivery: Sizing and Reliability Contracts
An AMQP message is a parcel with a label, a body, and a delivery receipt path.
Broker Bex is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Explain: Adding the assumed 200-byte transaction cost to every message would raise this model's bandwidth from ~197 to ~360 Kbps (about 1.8×); transactions alone would not provide exactly-once business processing.
- Explain: Batching 10 readings into one 1,200-byte message improves efficiency from 51% to 91%, saving (10×236B)−(1,200B+116B)=1,044B per 10 readings (44% reduction).
- Explain: The two disk settings only work together: a persistent message in a transient queue is not saved, and a transient message in a durable queue is not saved either.
Major section
Putting Numbers to It
For telemetry with 120-byte payloads, nearly half the bandwidth is protocol overhead.
- Batching 10 readings into one 1,200-byte message improves efficiency from 51% to 91%, saving (10×236B)−(1,200B+116B)=1,044B per 10 readings (44% reduction).
- Conclusion: The telemetry (about 98% of messages) uses fire-and-forget, keeping broker load minimal.
- Adding the assumed 200-byte transaction cost to every message would raise this model's bandwidth from ~197 to ~360 Kbps (about 1.8×); transactions alone would not provide exactly-once business processing.
Major section
AMQP Delivery Reliability Chain Contracts
The message reaches a queue, the worker writes the incident, and then the worker crashes before it says the job is done.
- One durable setting cannot protect a different gap in the chain.
- The chain can notify and retain evidence, but it must not be the sole route to stop immediate harm.
- The next worker may see the same alarm, so the team must prevent a second incident without losing the first.
- This opening does not promise exactly-once physical action.
Major section
AMQP Delivery Reliability Chain Contracts (continued)
AMQP Message Delivery teaches message structure, delivery modes, publisher confirms, consumer acknowledgments, prefetch, dead-letter queues, and delivery sizing.
- This page tightens the contract that connects those pieces: no single flag makes delivery reliable, and each acknowledgment only means something inside its scope.
- Concrete chain example: a gateway sends a valve-state alarm and keeps its local copy until the broker sends a publisher confirm.
- Retrying from a message id makes the duplicate detectable.
Major section
AMQP Delivery Reliability Chain Contracts (continued)
If the broker confirms and then restarts, the durable queue and persistent message are what make the alarm still appear after recovery.
- If the consumer receives the alarm, writes it to an incident table, and crashes before basic.ack, the broker requeues the unacknowledged delivery on channel close.
- Treating those as one chain keeps operators from over-trusting a single durable setting.
- That requeue is why at-least-once can *duplicate*.
Major section
AMQP Delivery Reliability Chain Contracts (continued)
The consumer reads, writes the reading to the database, and only then sends basic.ack.
- The practical audit question is therefore always, "where can the message be acknowledged but not yet recoverable?" Publisher confirms answer the producer side, persistence answers the broker restart side, and manual acknowledgements answer the consumer side.
- The two disk settings only work together: a persistent message in a transient queue is not saved, and a transient message in a durable queue is not saved either.
- If four consumers each use basic.qos(prefetch_count=20), as many as 80 messages can be delivered but unacknowledged at once.
Major section
AMQP Delivery Reliability Chain Contracts (continued)
Publisher confirms even close the fsync race -- the broker only confirms a persistent message routed to a durable queue after it is on disk.
- Worked example -- a meter reading that must not be lost: The producer opens confirm mode, publishes with delivery-mode=2 to a durable queue, and waits for the broker's confirm before deleting its local copy.
- A worker crash with 17 unacked messages does not lose those messages; they return to the queue when the channel closes.
- That count is what lets a retry loop give up after N attempts instead of cycling a poison message forever.
Deck summary
Key takeaways
For telemetry with 120-byte payloads, nearly half the bandwidth is protocol overhead.
- The message reaches a queue, the worker writes the incident, and then the worker crashes before it says the job is done.
- AMQP Message Delivery teaches message structure, delivery modes, publisher confirms, consumer acknowledgments, prefetch, dead-letter queues, and delivery sizing.
- If the broker confirms and then restarts, the durable queue and persistent message are what make the alarm still appear after recovery.
- The consumer reads, writes the reading to the database, and only then sends basic.ack.
Retrieval practice
Recall check 1 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q1A plant has 500 machines. Each sends one reading every 5 seconds. What is the average reading rate?
Show answer
Answer: D Divide the machine count by the time between readings.
Q2Who creates an AMQP message and sends it to an exchange?
Show answer
Answer: D The publisher creates the message and sends it to an exchange.
Q3Complete the AMQP publisher with persistent delivery mode and publisher confirms:
Show answer
Answer: A Publisher confirms are enabled with confirm_delivery().
Retrieval practice
Recall check 2 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q4Per this chapter's sizing worked example (four consumers, each with prefetch_count=20), why does a worker crash while holding 17 unacknowledged messages not lose those 17 messages?
Show answer
Answer: D Unacknowledged messages are still owned by the queue until acked.
Retrieval practice
Recall check 3 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q5A durable queue holds delivery-mode 1 (transient) messages. After a broker restart, what persistence guarantee is missing, and which message property addresses that gap?
Show answer
Answer: B A durable queue definition can survive restart while delivery-mode 1 messages have no persistence guarantee.
Retrieval practice
Recall check 4 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q6A poison message keeps failing after bounded retries. Where should it go for investigation?
Show answer
Answer: A Parking stops the retry loop and keeps the evidence needed for repair.
Print reference
Answers
Answer key.
- D · Divide the machine count by the time between readings.
- D · The publisher creates the message and sends it to an exchange.
- A · Publisher confirms are enabled with confirm_delivery().
- D · Unacknowledged messages are still owned by the queue until acked.
- B · A durable queue definition can survive restart while delivery-mode 1 messages have no persistence guarantee.
- A · Parking stops the retry loop and keeps the evidence needed for repair.