AMQP · Study deck
AMQP Delivery: Guarantees and Acknowledgements
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:
- Analyze Message Structure: Distinguish the role of AMQP header, properties, and body sections and explain how each field affects message routing and delivery
- Configure Delivery Modes: Select appropriate message persistence, priority, and time-to-live (TTL) settings to match application reliability requirements
- Implement Delivery Guarantees: Evaluate at-most-once and at-least-once delivery, and implement exactly-once processing with application deduplication based on data criticality and overhead trade-offs
- Apply Acknowledgments: Demonstrate correct use of publisher confirms and consumer acknowledgments to construct reliable messaging pipelines
Major section
In 60 Seconds
Losing one reading may be acceptable.
- Losing the order is not.
- Repeating the order may also create two visits, so the sender needs evidence of the receiver's final result, not only evidence that a message left.
- AMQP is a set of messaging rules for moving labelled messages through a message service.
- The application must close its own result.
Major section
In 60 Seconds (continued)
AMQP 0-9-1 messages have properties (delivery mode, priority, expiration/TTL, correlation ID, message ID) and a body.
- For each message class, record identity, sender, receiver, allowed age, repeat rule, order need, storage need, acceptance point, and final business result.
- Stored delivery does not prove that the receiver acted, and a confirmation does not prove that the message was true.
- Dead-letter queues can retain selected rejected, expired, or overflowed messages for investigation when configured.
Major section
The Tracked Package
"My temperature alert says the warehouse is overheating, but the cooling system never turned on!" Temperature Terry cried. "What happened to my message?".
- When you sent your alert, did you ask for a publisher confirm?" Sammy looked blank. "That's like asking the post office to text you when they receive your package.
- If the cooling system crashes before saying ACK, the broker sends the message again.
- Engineers can check it later to find out what went wrong.
Major section
Message Structure
Reliability depends on the routing, persistence, timing, and identity metadata the message carries.
- An AMQP message consists of multiple sections that provide metadata and payload.
- Delivery controls such as durability and priority belong in the header; identifiers and content description travel as properties; the application value remains in the body.
Major section
Delivery Guarantees
Once the parcel is shaped, choose the promise: speed and low overhead, or stronger protection against loss.
- AMQP provides configurable delivery semantics to match application requirements.
- Acknowledgment and retry trade possible loss for possible duplication; stronger coordination costs more state.
- Fastest but may lose messages.
- This needs publisher confirms, durable queues and manual consumer ACKs.
Major section
Delivery Guarantees (continued)
Each message is delivered one or more times: once the broker confirms it, it is retried rather than silently dropped, but duplicates are possible.
- Delivery still depends on the configured broker and recovery path.
- AMQP 0-9-1 can redeliver after a lost acknowledgment.
- The aim here is one business effect even if the message is processed again.
Major section
Try It: Delivery Guarantee Simulator
It assumes one retry after an uncertain first attempt; an unconfirmed result is counted as lost in the display.
- Real broker guarantees depend on confirms, persistence, routing, consumer acknowledgments, and recovery.
Major section
Publisher Confirms
Delivery promises begin before the consumer sees the message.
- Publisher confirms allow producers to know when messages are safely received by the broker.
- The broker then reaches the durable acceptance boundary configured for that connection before returning an ACK.
- The application must gather those later results separately.
Major section
Consumer Acknowledgments
After broker receipt, ACK and NACK behavior decides whether a queued message is removed, retried, or routed elsewhere.
- If the work ends well, basic_ack() lets the broker remove that delivery.
- If the work fails, follow the NACK branch.
- With requeue=True, the broker can send the message again.
- The handler must therefore make a repeat safe.
Major section
Consumer Acknowledgments (continued)
This fork ties the ACK rule to retry bounds, safe repeats, and prefetch limits.
- Each setting controls a different part of a failed attempt.
- Prefetch controls how many unacknowledged messages a consumer can hold.
- Raise the value only when measured idle time shows that additional overlap improves throughput without hiding too much unfinished work in one process.
Major section
Dead Letter Queues
The last part of the reliability chain is evidence: failed messages should land somewhere inspectable.
- Dead letter queues (DLQ) capture messages that cannot be processed successfully.
- The exchange routes the failed message into the DLQ, where it can be inspected with its failure context.
Deck summary
Key takeaways
Losing one reading may be acceptable.
- AMQP 0-9-1 messages have properties (delivery mode, priority, expiration/TTL, correlation ID, message ID) and a body.
- "My temperature alert says the warehouse is overheating, but the cooling system never turned on!" Temperature Terry cried. "What happened to my message?".
- Reliability depends on the routing, persistence, timing, and identity metadata the message carries.
- Once the parcel is shaped, choose the promise: speed and low overhead, or stronger protection against loss.
Retrieval practice
Recall check 1 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q1Per this chapter's Properties Section, which two AMQP properties work together to implement a request/reply (RPC) pattern over queues?
Show answer
Answer: A see answers page
Retrieval practice
Recall check 2 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q2A water utility deploys AMQP to transmit two data streams: (1) water flow meter readings every 2 seconds across 1,000 sensors, and (2) automated valve-close commands triggered when a leak is detected. Which delivery modes should be configured, and why does the distinction matter at scale?
Show answer
Answer: C Choose the delivery path from the consequence of loss.
Retrieval practice
Recall check 3 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q3The shown Pika snippet calls confirm_delivery() before a blocking basic_publish(), then labels add_on_return_callback(on_confirm) as asynchronous publisher confirms. Which review finding is correct?
Show answer
Answer: D In the shown Pika BlockingChannel example, confirm_delivery makes basic_publish use synchronous publisher confirms.
Retrieval practice
Recall check 4 of 4

Broker Bex says: answer from memory, then check your reasoning.
Q4Per this chapter's DLQ Triggers list, which of the following does the chapter NOT list as a way a message ends up in a dead-letter queue?
Show answer
Answer: C The chapter's DLQ Triggers list has exactly four entries: consumer rejects with requeue=false, message TTL expires, queue length exceeded, and message rejected after max retries.
Print reference
Answers 1 of 2
Answer key.
- A · The chapter's Key Concepts section states Correlation-ID is 'essential for request/reply patterns over queues,' and the properties table pairs it with Reply-To as the 'return address queue.' Together they let a requester publish to a well-known queue, specify where the reply should land (Reply-To), and match the eventual reply back to its original request (Correlation-ID).
- C · Choose the delivery path from the consequence of loss.
Print reference
Answers 2 of 2
Answer key.
- D · In the shown Pika BlockingChannel example, confirm_delivery makes basic_publish use synchronous publisher confirms.
- C · The chapter's DLQ Triggers list has exactly four entries: consumer rejects with requeue=false, message TTL expires, queue length exceeded, and message rejected after max retries.