← Back to the chapter · Next detail →

Technical detail · AMQP Delivery: Guarantees and Acknowledgements

Delivery fields across AMQP versions

FieldDescriptionCommon Values
DurableMessage survives broker restartTrue (persistent), False (transient)
PriorityMessage priority level0-9 (0 lowest, 9 highest)
TTLTime-To-Live before expirationMilliseconds (e.g., 60000 for 1 minute)
First-AcquirerFirst consumer to receiveBoolean
Delivery-CountNumber of delivery attemptsInteger

The durable, first-acquirer and delivery-count names in this table belong to AMQP 1.0. For AMQP 0-9-1, the following Pika fragment requests persistence, priority 8 and a 60-second expiration. It publishes order 12345 through orders with routing key order.priority. Queue declaration, binding and confirmation are separate setup.

import pika

properties = pika.BasicProperties(
    delivery_mode=2,  # Persistent (survives restart)
    priority=8,       # High priority (0-9 scale)
    expiration='60000'  # TTL: 60 seconds
)

channel.basic_publish(
    exchange='orders',
    routing_key='order.priority',
    body='{"order_id": 12345}',
    properties=properties
)

← Back to the chapter · Next detail →