Skip to content

Reference: Binding CRD

A Binding connects a source exchange to a destination queue or exchange in your RabbitMQ cluster. The source exchange uses the binding's routing key and arguments to decide which messages to route to the destination. A Binding cannot change after creation, except for its cluster reference. To change a binding, delete it and create a new one.

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

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

Example

apiVersion: rabbitmq.com/v1beta1
kind: Binding
metadata:
  name: my-app-orders-to-tasks
  namespace: your-application-namespace
spec:
  vhost: my-app-vhost
  # The RabbitMQ name of the source exchange
  source: orders
  # The RabbitMQ name of the destination queue
  destination: tasks.work
  destinationType: queue
  routingKey: "orders.eu.*"
  rabbitmqClusterReference:
    name: my-rabbitmq-cluster

Specification (spec)

Field Type Description
vhost string Optional. The RabbitMQ name of the virtual host. Default: /. You cannot change this field after creation.
source string Optional. The RabbitMQ name of the source exchange. You cannot change this field after creation.
destination string Optional. The RabbitMQ name of the destination queue or exchange. You cannot change this field after creation.
destinationType string Optional. The kind of destination. Allowed values: queue, exchange. You cannot change this field after creation.
routingKey string Optional. The binding key. How the source exchange uses it depends on the exchange type. For example, a topic exchange matches it as a pattern, and a fanout exchange ignores it. You cannot change this field after creation.
arguments object Optional. Binding arguments as key-value pairs. A headers exchange uses them to match message headers, for example x-match: all. You cannot change this field after creation.
rabbitmqClusterReference object Required. The RabbitMQ cluster to create the binding in. You cannot change this field after creation. See spec.rabbitmqClusterReference.

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 Binding. 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 binding exists in RabbitMQ, and False with reason FailedCreateOrUpdate and an error message otherwise. A missing source or destination shows up here.
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