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:
- Knative Eventing
- RabbitMQ Cluster Operator - our recommendation is latest release
- CertManager v1.5.4 - easiest integration with RabbitMQ Messaging Topology Operator
- RabbitMQ Messaging Topology Operator - our recommendation is latest release with CertManager
Install the RabbitMQ controller¶
-
Install the RabbitMQ controller by running the command:
kubectl apply -f https://storage.googleapis.com/knative-nightly/eventing-rabbitmq/latest/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:
WhereapiVersion: rabbitmq.com/v1beta1 kind: RabbitmqCluster metadata: name: <cluster-name> annotations: # A single RabbitMQ cluster per Knative Eventing installation rabbitmq.com/topology-allowed-namespaces: "*"
<cluster-name>
is the name you want for your RabbitMQ cluster, for example,rabbitmq
. -
Apply the YAML file by running the command:
Wherekubectl create -f <filename>
<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:Wherekubectl get rmq <cluster-name>
<cluster-name>
is the name you gave your cluster in the step above.Example output:
NAME ALLREPLICASREADY RECONCILESUCCESS AGE rabbitmq True True 38s
For more information about configuring the RabbitmqCluster
CRD, see the
RabbitMQ website.
Create a RabbitMQ broker config object¶
-
Create a YAML file using the following template:
WhereapiVersion: eventing.knative.dev/v1alpha1 kind: RabbitmqBrokerConfig metadata: name: <rabbitmq-broker-config-name> spec: rabbitmqClusterReference: name: <cluster-name> queueType: quorum
is the name of the RabbitMQ cluster created in the step above. -
Apply the YAML file by running the command:
Wherekubectl create -f <filename>
<filename>
is the name of the file you created in the previous step.
Create a RabbitMQ broker object¶
-
Create a YAML file using the following template:
WhereapiVersion: eventing.knative.dev/v1 kind: Broker metadata: annotations: eventing.knative.dev/broker.class: RabbitMQBroker name: <broker-name> spec: config: apiVersion: rabbitmq.com/v1beta1 kind: RabbitmqBrokerConfig name: <rabbitmq-broker-config-name>
<rabbitmq-broker-config-name>
is the name you gave your RabbitMQ Broker config in the step above. -
Apply the YAML file by running the command:
Wherekubectl apply -f <filename>
<filename>
is the name of the file you created in the previous step.
Configure message ordering¶
By default, Triggers will consume messages one at a time to preserve ordering. If ordering of events isn't important and higher performance is desired, you can configure this by using the
parallelism
annotation. Setting parallelism
to n
creates n
workers for the Trigger that will all consume messages in parallel.
The following YAML shows an example of a Trigger with parallelism set to 10
:
```yaml apiVersion: eventing.knative.dev/v1 kind: Trigger metadata: name: high-throughput-trigger annotations: rabbitmq.eventing.knative.dev/parallelism: "10" ...
Additional information¶
To report a bug or request a feature, open an issue in the eventing-rabbitmq repository.