Queues

Queues with RabbitMQ

The RabbitMQ® engine for Queues offers full messaging for microservices: exchanges, routing keys, acknowledgments, and dead-lettering. The version is 4.4 and the protocol is AMQP 0-9-1. For simple background tasks, the Valkey engine may be enough; see the comparison in Queues: choose an engine.

Plans and high availability

RabbitMQ uses the same paid plans and prices as the other Queues: queue-starter, queue-basic, queue-premium, and queue-enterprise. There is no free plan for RabbitMQ; queue-free is Valkey only. Check capacity and price in the plan guide.

PlanNodesDefault queue typeMetrics
queue-starter1classicno
queue-basic3, highly availablequorumno
queue-premium3, highly availablequorumyes
queue-enterprise3, highly availablequorumyes

Quorum queues replicate each message across nodes and stay available if one node fails. Single-node plans have no replica: if the node becomes unavailable, the queue waits for it to return. Among the Basic, Premium, and Enterprise plans, change the plan in the Plan card when editing the project (permission Allow plan change): the 3 nodes restart one at a time, open connections drop and the application must reconnect, and stored queues and messages are kept. Enterprise needs at least 20 GB of storage; expand the storage before switching to it. Starter has 1 node and does not change plan; to move off it, create a new queue on the plan you want. To get more room, increase the storage. See Storage and the storage API.

Connection

The connection uses TLS and has this format:

amqps://app:<password>@rabbitmq-<id>.managed.zenifra.com:<port>/
  • User: app. Virtual host: /.
  • The password is shown only at creation and after a credential rotation. After that, the Console shows the URL with the password masked.
  • Outside Zenifra, only TLS connections (amqps) are accepted.
  • Store the URL as a protected environment variable (for example, RABBITMQ_URL) in the application project.

By default, the host and port are public. You can turn off public access; in that case, the service is only reached through private connections between applications. The GET /v1/managed-services/:id/connection response reports the state in exposure.

Private connection

Applications in your organization linked to RabbitMQ through a private connection use the internal address <project>.<organization-id>.zenifra.local, on port 5672 with amqp://; the traffic stays inside the private network. The step-by-step is in Private connection to RabbitMQ.

Node.js and TypeScript

npm install amqplib
import amqp from 'amqplib'

const connection = await amqp.connect(process.env.RABBITMQ_URL!)
const channel = await connection.createConfirmChannel()

// Dead-letter exchange and the queue that stores rejected messages
await channel.assertExchange('orders.dlx', 'direct', { durable: true })
await channel.assertQueue('orders.dead', { durable: true })
await channel.bindQueue('orders.dead', 'orders.dlx', 'created')

// Main exchange, work queue, and binding by routing key
await channel.assertExchange('orders', 'topic', { durable: true })
await channel.assertQueue('orders.created', {
  durable: true,
  arguments: {
    'x-dead-letter-exchange': 'orders.dlx',
    'x-dead-letter-routing-key': 'created',
  },
})
await channel.bindQueue('orders.created', 'orders', 'orders.created')

// Persistent publish, with server confirmation
channel.publish('orders', 'orders.created', Buffer.from(JSON.stringify({ id: 42 })), {
  persistent: true,
  contentType: 'application/json',
})
await channel.waitForConfirms()

// Consume with manual acknowledgment
await channel.prefetch(10)
await channel.consume('orders.created', async (message) => {
  if (!message) return
  try {
    console.log('process message', JSON.parse(message.content.toString()))
    channel.ack(message)
  } catch {
    channel.nack(message, false, false) // no requeue: goes to the dead-letter
  }
})

amqplib validates the server certificate when the URL uses amqps://. Processing must be idempotent: a message may be delivered more than once after a failure or a reconnection.

Python

python -m pip install pika
import json
import os
import ssl
from urllib.parse import urlparse

import pika

url = os.environ["RABBITMQ_URL"]
params = pika.URLParameters(url)
params.ssl_options = pika.SSLOptions(ssl.create_default_context(), urlparse(url).hostname)

connection = pika.BlockingConnection(params)
channel = connection.channel()
channel.confirm_delivery()

# Dead-letter
channel.exchange_declare("orders.dlx", exchange_type="direct", durable=True)
channel.queue_declare("orders.dead", durable=True)
channel.queue_bind("orders.dead", "orders.dlx", routing_key="created")

# Main exchange, work queue, and binding by routing key
channel.exchange_declare("orders", exchange_type="topic", durable=True)
channel.queue_declare(
    "orders.created",
    durable=True,
    arguments={"x-dead-letter-exchange": "orders.dlx", "x-dead-letter-routing-key": "created"},
)
channel.queue_bind("orders.created", "orders", routing_key="orders.created")

# Persistent publish (the server confirmation is awaited)
channel.basic_publish(
    "orders",
    "orders.created",
    json.dumps({"id": 42}),
    properties=pika.BasicProperties(delivery_mode=2, content_type="application/json"),
)

# Consume with manual acknowledgment
def handle(ch, method, properties, body):
    try:
        print("process message", json.loads(body))
        ch.basic_ack(method.delivery_tag)
    except Exception:
        ch.basic_nack(method.delivery_tag, requeue=False)  # goes to the dead-letter

channel.basic_qos(prefetch_count=10)
channel.basic_consume("orders.created", on_message_callback=handle)
channel.start_consuming()

Exchanges, routing keys, and dead-letter

  • Exchange: receives the message from the producer and routes it to the queues bound to it. The most common types are direct (exact routing key), topic (patterns such as orders.*), and fanout (all queues).
  • Routing key: a label the producer puts on the message and that the binding uses to decide the destination queue.
  • Acknowledgments: the consumer confirms with ack after processing; with nack and no requeue, the message goes to the dead-letter. Publisher confirms (waitForConfirms, confirm_delivery) guarantee that the server received the message.
  • Dead-letter: declare the queue with x-dead-letter-exchange (and, optionally, x-dead-letter-routing-key). Messages rejected with nack and no requeue, or expired, go to the indicated exchange.

You configure everything from your own AMQP client, in the application code: the app user can create, change and delete exchanges, queues and bindings on the / virtual host. The most common arguments when declaring a queue are x-queue-type, x-message-ttl (message expiry), x-max-length and x-max-length-bytes (below the plan limit), x-dead-letter-exchange and x-single-active-consumer. There is no management UI or RabbitMQ HTTP API, and server policies are set by Zenifra, such as the maximum queue size of each plan.

A queue declared without x-queue-type uses the plan's default type. Redeclaring an existing queue with different arguments causes an error; create a new queue or delete the old one.

Scheduled delivery

To deliver a message only from a given time on, publish it with the x-opt-delivery-time header: the delivery time in milliseconds since 1970 (Unix epoch), as an integer. The queue stores the message right away and only delivers it to consumers once that time arrives. No plugin or special exchange is needed.

// Deliver 10 minutes from now
channel.publish('orders', 'orders.reminder', Buffer.from(JSON.stringify({ id: 42 })), {
  persistent: true,
  headers: { 'x-opt-delivery-time': Date.now() + 10 * 60 * 1000 },
})
import time

channel.basic_publish(
    exchange="orders",
    routing_key="orders.reminder",
    body=json.dumps({"id": 42}),
    properties=pika.BasicProperties(
        delivery_mode=2,
        headers={"x-opt-delivery-time": int(time.time() * 1000) + 10 * 60 * 1000},
    ),
)
  • It works on quorum queues, the default on the Basic, Premium and Enterprise plans. On Starter the default is a classic queue, which ignores the header and delivers right away; declare the queue with x-queue-type: quorum to use scheduled delivery.
  • Messages leave in delivery-time order, not publish order, and count toward the maximum queue size while they wait.
  • In our tests, no message left before its time, and delivery happened 5 to 70 ms after it. Messages scheduled before a plan change were delivered on time after the change.
  • The old rabbitmq_delayed_message_exchange plugin (x-delay header) is not available; use x-opt-delivery-time.

Limits per plan

PlanConnectionsChannels per connectionTotal channelsMax message sizeMax queue size
queue-starter1001284004 MiB128 MiB
queue-basic3002561,20016 MiB256 MiB
queue-premium1,0005123,00016 MiB512 MiB
queue-enterprise5,0001,02412,00016 MiB2 GiB

These are the current limits and may change. "Total channels" adds up the channels of all connections; past it, the server refuses the new channel. When a queue reaches its maximum size, new publishes to it are rejected. When the service memory fills, publishing is blocked until consumers drain messages; keep consumers running and watch the metrics.

Measured performance

We measured each plan in November 2026 with the load we recommend to avoid losing messages: durable queues of the plan's default type, persistent 1 KiB messages, publisher confirms and manual consumer ack. The client used amqplib (Node.js), connected through the public TLS URL from the same region, and every confirmed message was delivered.

Throughput (messages published and consumed per second, from the start to the end of the test):

Plan1 queue, 2 producers and 2 consumers4 queues, 1 producer and 1 consumer each
queue-starterabout 3,100about 3,100
queue-basicabout 6,700about 8,800
queue-premiumabout 8,900about 10,000
queue-enterpriseabout 7,500about 9,600

Latency (from publishing to delivery to the consumer):

Plan100 messages/s: median100 messages/s: p991,000 messages/s: median1,000 messages/s: p99
queue-starter1.5 ms4.2 ms3.7 ms27 ms
queue-basic7.2 ms13 ms12 ms23 ms
queue-premium7.9 ms39 ms12 ms42 ms
queue-enterprise8.2 ms17 ms12 ms32 ms

How to read these numbers:

  • On Starter, the single-node classic queue answers faster, but the plan's CPU reaches its limit near 3,000 messages per second. With the server at its limit, publishing takes priority and consumption falls behind; messages stay in the queue and are delivered later.
  • From Basic up, each message is written to disk on all 3 nodes before it is confirmed. That adds a few milliseconds of latency and keeps a single queue near 7,000 to 9,000 messages per second on any plan. Spreading the load across several queues raises the total throughput a little: with 16 queues in parallel, Basic reached about 8,400 and Enterprise about 11,300 messages per second, both with CPU to spare.
  • Larger plans do not make one message faster: they accept more connections and channels, hold larger queues and leave CPU and memory headroom for many queues, consumers and peaks.
  • Results vary with message size, the number of queues and connections, the use of confirms and the distance between the application and the service. To decide, measure your own load on an hourly test queue and remove it when you are done.

Plan change under traffic

We changed the plan from Basic to Premium and from Premium to Enterprise with a producer and a consumer connected, publishing 200 messages per second, and with 1,000 messages stored in another queue with no consumer:

MeasureResult
Duration of the change, with the 3 nodes restarting one at a timeabout 4 minutes
Confirmed messages lostnone
Producer and consumer disconnections2 each, reconnected in about 1 second
Longest pause without a publish confirmabout 1.4 seconds
Messages delivered twiceabout 0.03%, all redelivered by the server with redelivered set, because the consumer ack did not arrive before the disconnection
Stored messages read after the change, with the same credential and on the same queue1,000 of 1,000

To get through a plan change without losing messages, the application has to reconnect on its own, resend publishes that were not confirmed and handle repeated messages with an idempotency key.

Metrics

On the Premium and Enterprise plans, the project page shows queues, ready and unacknowledged messages, consumers, publish and delivery rates, and a warning when memory is full. Growing unacknowledged messages indicate slow consumers or consumers that do not ack.

Backups

Automatic backups are included in the plan, with restores done by support. See Automatic backups.

What the backup guarantees, up to the last backup taken:

  • messages in persistent queues (durable or quorum);
  • configuration: exchanges, queues, bindings, users, and policies.

What is not guaranteed:

  • messages published after the last backup;
  • messages in non-persistent queues.

To avoid losing messages, use durable queues, publish with persistent and publisher confirms, and keep consumers idempotent.

Frequently asked questions

Can I connect without TLS?

No. Outside Zenifra, only amqps:// is accepted.

Can I install plugins or open the management UI?

No. Plugins are set by Zenifra and no optional plugin is enabled, such as shovel, federation, streams, MQTT, STOMP or the delayed message exchange; to delay a delivery, use scheduled delivery. The management UI and the RabbitMQ HTTP API are not exposed; use the metrics on the project page. If your application depends on a plugin, contact support.

Can I use multiple virtual hosts or users?

The connection provided uses the / virtual host and the app user.

Does RabbitMQ guarantee exactly-once delivery?

No. As with any RabbitMQ, delivery is at-least-once: if the connection drops after the consumer received a message and before its ack reached the server, the server delivers it again with redelivered set; and a producer that resends an unconfirmed publish may store it twice. This happens on network drops, restarts and plan changes. Use an idempotency key in the application to process each message only once.

Next steps

RabbitMQ® is a trademark of Broadcom, Inc. in the U.S. and other countries. Zenifra is not affiliated with or endorsed by Broadcom.

Last updated on

On this page