Creating a RabbitMQ Broker
This topic describes how to create a RabbitMQ Broker.
Prerequisites
To use the RabbitMQ Broker, you must have the following installed:
Install the RabbitMQ controller
Install the RabbitMQ controller by running the command:
kubectl apply -f https://github.com/knative-sandbox/eventing-rabbitmq/releases/download/knative-v1.0.0/rabbitmq-broker.yaml
Verify that
rabbitmq-broker-controller
andrabbitmq-broker-webhook
are running:kubectl get deployments.apps -n knative-eventing
Example output:
NAME READY UP-TO-DATE AVAILABLE AGE
eventing-controller 1/1 1 1 10s
eventing-webhook 1/1 1 1 9s
rabbitmq-broker-controller 1/1 1 1 3s
rabbitmq-broker-webhook 1/1 1 1 4s
Create a RabbitMQ cluster
Deploy a RabbitMQ cluster:
Create a YAML file using the following template:
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
name: <cluster-name>
Where
<cluster-name>
is the name you want for your RabbitMQ cluster, for example,hello-world
.Apply the YAML file by running the command:
kubectl create -f <filename>
Where
<filename>
is the name of the file you created in the previous step.
Wait for the cluster to become ready. When the cluster is ready,
ALLREPLICASREADY
will betrue
in the output of the following command:kubectl get rmq <cluster-name>
Where
<cluster-name>
is the name you gave your cluster in the step above.Example output:
NAME ALLREPLICASREADY RECONCILESUCCESS AGE
hello-world True True 38s
For more information about configuring the RabbitmqCluster CRD, see the RabbitMQ website.
Create a RabbitMQ Broker object
Create a YAML file using the following template:
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
annotations:
eventing.knative.dev/broker.class: RabbitMQBroker
name: <cluster-name>
spec:
config:
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
name: <cluster-name>
# Optional
delivery:
deadLetterSink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: <deadlettersink-name>
uri: <deadlettersink-uri>
Where:
<cluster-name>
is the name you gave your RabbitMQ cluster.<deadlettersink-name>
is the name of the Service you want to use for dead-lettered messages, for example,dlq-service
.<deadlettersink-uri>
is the URI you want to use for dead-lettered messages, for example,https://my.dlq.example.com
.
Note
Specifying a
delivery.deadLetterSink
is optional. You can specify it either as an object reference using theref
field, or URI using theuri
field.Apply the YAML file by running the command:
kubectl apply -f <filename>
Where
<filename>
is the name of the file you created in the previous step.
Additional information
To report a bug or request a feature, open an issue in the eventing-rabbitmq repository.