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:

  1. Knative Eventing
  2. RabbitMQ Cluster Operator
  3. RabbitMQ Messaging Topology Operator

Install the RabbitMQ controller

  1. Install the RabbitMQ controller by running the command:

    1. kubectl apply -f https://github.com/knative-sandbox/eventing-rabbitmq/releases/download/knative-v1.0.0/rabbitmq-broker.yaml
  2. Verify that rabbitmq-broker-controller and rabbitmq-broker-webhook are running:

    1. kubectl get deployments.apps -n knative-eventing

    Example output:

    1. NAME READY UP-TO-DATE AVAILABLE AGE
    2. eventing-controller 1/1 1 1 10s
    3. eventing-webhook 1/1 1 1 9s
    4. rabbitmq-broker-controller 1/1 1 1 3s
    5. rabbitmq-broker-webhook 1/1 1 1 4s

Create a RabbitMQ cluster

  1. Deploy a RabbitMQ cluster:

    1. Create a YAML file using the following template:

      1. apiVersion: rabbitmq.com/v1beta1
      2. kind: RabbitmqCluster
      3. metadata:
      4. name: <cluster-name>

      Where <cluster-name> is the name you want for your RabbitMQ cluster, for example, hello-world.

    2. Apply the YAML file by running the command:

      1. kubectl create -f <filename>

      Where <filename> is the name of the file you created in the previous step.

  2. Wait for the cluster to become ready. When the cluster is ready, ALLREPLICASREADY will be true in the output of the following command:

    1. kubectl get rmq <cluster-name>

    Where <cluster-name> is the name you gave your cluster in the step above.

    Example output:

    1. NAME ALLREPLICASREADY RECONCILESUCCESS AGE
    2. hello-world True True 38s

For more information about configuring the RabbitmqCluster CRD, see the RabbitMQ website.

Create a RabbitMQ Broker object

  1. Create a YAML file using the following template:

    1. apiVersion: eventing.knative.dev/v1
    2. kind: Broker
    3. metadata:
    4. annotations:
    5. eventing.knative.dev/broker.class: RabbitMQBroker
    6. name: <cluster-name>
    7. spec:
    8. config:
    9. apiVersion: rabbitmq.com/v1beta1
    10. kind: RabbitmqCluster
    11. name: <cluster-name>
    12. # Optional
    13. delivery:
    14. deadLetterSink:
    15. ref:
    16. apiVersion: serving.knative.dev/v1
    17. kind: Service
    18. name: <deadlettersink-name>
    19. 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 the ref field, or URI using the uri field.

  2. Apply the YAML file by running the command:

    1. 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.