Queues

September 11, 2026 · View on GitHub

A queue is a named, ordered store of messages, owned by a vhost, that delivers those messages to one or more consumers. It is the destination that exchanges route messages to via bindings.

Queue Types

The queue type is selected at declaration time and cannot be changed afterwards.

Typex-queue-typeDescription
Standard(default)FIFO queue with optional durability
Priority(use x-max-priority)Delivers messages by priority
StreamstreamAppend-only log for multiple consumers
MQTT SessionmqttInternal, used by MQTT sessions

See also: Priority Queues, Streams, Delayed Queues

Queue Properties

PropertyDescription
durableQueue survives server restart. Messages in a durable queue are persisted to disk.
exclusiveQueue is exclusive to the declaring connection. Deleted when the connection closes. Cannot be accessed by other connections.
auto_deleteQueue is deleted when the last consumer unsubscribes.

A non-durable, non-exclusive queue is called a transient queue. Its messages are still written to disk but the queue is removed on server restart.

Queue Arguments

ArgumentTypeDescription
x-message-ttlInt (>= 0)Default message TTL in milliseconds. See TTL.
x-expiresInt (>= 1)Queue expiration after inactivity in milliseconds. See TTL.
x-max-lengthInt (>= 0)Maximum number of messages in the queue
x-max-length-bytesInt (>= 0)Maximum total size of messages in bytes
x-overflowStringOverflow behavior (see below)
x-dead-letter-exchangeStringDead letter exchange. See Dead Lettering.
x-dead-letter-routing-keyStringRouting key for dead-lettered messages
x-delivery-limitInt (>= 0)Max redelivery attempts before dead-lettering
x-consumer-timeoutInt (>= 0)Consumer idle timeout in milliseconds
x-single-active-consumerBoolOnly one consumer receives messages at a time
x-max-priorityInt (0-255)Enable priority queue with this many priority levels
x-message-deduplicationBoolEnable message deduplication. See Deduplication.
x-cache-sizeInt (>= 0)Deduplication cache size
x-cache-ttlInt (>= 0)Deduplication cache TTL in milliseconds
x-deduplication-headerStringHeader to use for deduplication key

Overflow Behavior

When a queue reaches its x-max-length or x-max-length-bytes limit, the overflow policy determines what happens:

PolicyBehavior
drop-head (default)The oldest message is removed from the head of the queue
reject-publishNew messages are rejected (basic.nack sent to publisher)

Overflow behavior can be set via the x-overflow queue argument or the overflow policy.

Requeue Behavior

When a consumer rejects or nacks a message with requeue=true:

  • The message is placed back in the queue
  • It may be delivered to a different consumer
  • The redelivered flag is set to true on the next delivery

When requeue=false, the message is either dead-lettered (if a DLX is configured) or discarded.

Queue Declaration

Declaring a queue that already exists succeeds only if the properties and arguments match the existing queue. A mismatch results in a PRECONDITION_FAILED channel error.

Queue Deletion

Deleting a queue removes it and all its messages. Options:

  • if_unused — only delete if no consumers
  • if_empty — only delete if no messages

Purge

queue.purge removes all messages from a queue without deleting the queue itself.

Queue States

A queue can be in one of the following states:

StateDescription
runningNormal operation, delivering messages to consumers
pausedQueue stops delivering messages but continues accepting publishes. Resume via the API.
closedQueue is closed due to an error. Durable, non-exclusive queues can be restarted via the API.
deletedQueue has been deleted

Pause and resume are available via the management API (PUT /api/queues/:vhost/:name/pause and /resume). A closed queue can be restarted with PUT /api/queues/:vhost/:name/restart.

The queue list endpoints (GET /api/queues and GET /api/queues/:vhost) accept a state query parameter to only return queues in the given state(s), comma separated, e.g. ?state=closed or ?state=paused,closed.

Reserved Queue Name Prefixes

Queue names starting with amq. or mqtt. are reserved for server-internal use. Client queue declarations using these prefixes will be rejected, except for amq.direct.reply-to.* queues used for direct reply-to consumers.