Creating a RabbitMQ Broker
- You have installed Knative Eventing.
- You have installed - easiest integration with RabbitMQ Messaging Topology Operator
- You have installed RabbitMQ Messaging Topology Operator - our recommendation is with CertManager
- You have access to a working RabbitMQ instance. You can create a RabbitMQ instance by using the RabbitMQ Cluster Kubernetes Operator. For more information see the .
Install the RabbitMQ controller
Install the RabbitMQ controller by running the command:
Verify that and
rabbitmq-broker-webhook
are running:kubectl get deployments.apps -n knative-eventing
Example output:
Create a YAML file using the following template:
apiVersion: eventing.knative.dev/v1alpha1
kind: RabbitmqBrokerConfig
name: <rabbitmq-broker-config-name>
spec:
rabbitmqClusterReference:
# Configure name if a RabbitMQ Cluster Operator is being used.
name: <cluster-name>
# Configure connectionSecret if an external RabbitMQ cluster is being used.
connectionSecret:
name: rabbitmq-secret-credentials
queueType: quorum
- is the name you want for your RabbitMQBrokerConfig object.
- is the name of the RabbitMQ cluster you created earlier.
Note
You cannot set and
connectionSecret
at the same time, sincename
is for a RabbitMQ Cluster Operator instance running in the same cluster as the Broker, andconnectionSecret
is for an external RabbitMQ server.Apply the YAML file by running the command:
Where
<filename>
is the name of the file you created in the previous step.
Create a RabbitMQBroker object
-
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
eventing.knative.dev/broker.class: RabbitMQBroker
name: <broker-name>
spec:
config:
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqBrokerConfig
Where
<rabbitmq-broker-config-name>
is the name you gave your RabbitMQBrokerConfig in the step above. Apply the YAML file by running the command:
Where
<filename>
is the name of the file you created in the previous step.
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.
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
name: high-throughput-trigger
annotations:
rabbitmq.eventing.knative.dev/parallelism: "10"
...
Additional information
- For more samples visit the