Skip to content

Reference: Queue CRD

A Queue declares a queue in a virtual host of your RabbitMQ cluster. Applications publish messages to the queue through an exchange and consume them from the queue. Most queue properties cannot change after creation. To tune a queue later, for example its length limit or message TTL, apply a Policy to it instead of setting arguments.

  • apiVersion: rabbitmq.com/v1beta1
  • kind: Queue
  • Scope: Namespaced

This page documents the RabbitMQ Messaging Topology Operator v1.20.6.

Example

apiVersion: rabbitmq.com/v1beta1
kind: Queue
metadata:
  name: my-app-task-queue
  namespace: your-application-namespace
spec:
  # The name of the queue inside RabbitMQ
  name: tasks.work
  vhost: my-app-vhost
  type: quorum
  # Quorum queues must be durable
  durable: true
  autoDelete: false
  # Keep the queue and its messages if this resource is deleted
  deletionPolicy: retain
  rabbitmqClusterReference:
    name: my-rabbitmq-cluster

Specification (spec)

Field Type Description
name string Required. The name of the queue in RabbitMQ. You cannot change this field after creation.
vhost string Optional. The RabbitMQ name of the virtual host. Default: /. You cannot change this field after creation.
rabbitmqClusterReference object Required. The RabbitMQ cluster to create the queue in. You cannot change this field after creation. See spec.rabbitmqClusterReference.
type string Optional. The queue type: quorum, classic or stream. When omitted, RabbitMQ uses the default queue type of the virtual host, which is classic unless the Vhost sets defaultQueueType. You cannot change this field after creation.
durable boolean Optional. When true, the queue survives a broker restart. Default: false. Must be true for quorum and stream queues. You cannot change this field after creation.
autoDelete boolean Optional. When true, RabbitMQ deletes the queue after its last consumer unsubscribes, if it has had at least one consumer. Default: false. You cannot change this field after creation.
arguments object Optional. Optional queue arguments as key-value pairs, for example x-max-length-bytes: 1000000000 or x-delivery-limit: 10000. You cannot add, remove or change arguments after creation, so prefer a Policy. See RabbitMQ queue arguments.
deletionPolicy string Optional. What happens to the queue in RabbitMQ when you delete the Queue resource. delete removes the queue and its messages. retain keeps them. Allowed values: delete, retain. Default: delete.
deleteIfEmpty boolean Optional. Applies when deletionPolicy is delete. When true, the operator deletes the queue only if it has no ready messages. Otherwise the deletion fails and the operator retries.
deleteIfUnused boolean Optional. Applies when deletionPolicy is delete. When true, the operator deletes the queue only if it has no consumers. Otherwise the deletion fails and the operator retries.

spec.rabbitmqClusterReference

Identifies the RabbitMQ cluster. Set either name or connectionSecret, but not both.

Field Type Description
name string Optional. The name of the RabbitmqCluster resource. Set this field or connectionSecret.
namespace string Optional. The namespace of the RabbitmqCluster. Defaults to the namespace of the Queue. A cluster in another namespace accepts the reference only if its rabbitmq.com/topology-allowed-namespaces annotation lists your namespace.
connectionSecret object Optional. A reference (name) to a Secret with the keys uri, username and password for the management API of a RabbitMQ cluster that the RabbitMQ Cluster Operator does not manage. The Secret must have the label rabbitmq.com/topology-operator: "true". Set this field or name.

Status (status)

Field Type Description
conditions []object The Ready condition is True with reason SuccessfulCreateOrUpdate when the queue exists in RabbitMQ, and False with reason FailedCreateOrUpdate and an error message otherwise.
observedGeneration integer The most recent metadata.generation that the operator reconciled.

Platform Notes

  • We provision and manage the RabbitmqCluster resource in your namespace and give you its name. Set spec.rabbitmqClusterReference.name to that name. See Getting Started.

Further Reading