RabbitMQ

Detailed documentation on the RabbitMQ pubsub component

Component format

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: rabbitmq-pubsub
  5. namespace: default
  6. spec:
  7. type: pubsub.rabbitmq
  8. version: v1
  9. metadata:
  10. - name: host
  11. value: "amqp://localhost:5672"
  12. - name: durable
  13. value: "false"
  14. - name: deletedWhenUnused
  15. value: "false"
  16. - name: autoAck
  17. value: "false"
  18. - name: deliveryMode
  19. value: "0"
  20. - name: requeueInFailure
  21. value: "false"
  22. - name: prefetchCount
  23. value: "0"
  24. - name: reconnectWait
  25. value: "0"
  26. - name: concurrencyMode
  27. value: parallel

Warning

The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described here.

Spec metadata fields

FieldRequiredDetailsExample
hostYConnection-string for the rabbitmq hostamqp://user:pass@localhost:5672
durableNWhether or not to use durable queues. Defaults to “false”“true”, “false”
deletedWhenUnusedNWhether or not the queue sohuld be configured to auto-delete Defaults to “false”“true”, “false”
autoAckNWhether or not the queue consumer should auto-ack messages. Defaults to “false”“true”, “false”
deliveryModeNPersistence mode when publishing messages. Defaults to “0”. RabbitMQ treats “2” as persistent, all other numbers as non-persistent“0”, “2”
requeueInFailureNWhether or not to requeue when sending a negative acknolwedgement in case of a failure. Defaults to “false”“true”, “false”
prefetchCountNNumber of messages to prefecth. Consider changing this to a non-zero value for production environments. Defaults to “0”, which means that all available messages will be pre-fetched.“2”
reconnectWaitNHow long to wait (in seconds) before reconnecting if a connection failure occurs“0”
concurrencyModeNparallel is the default, and allows processing multiple messages in parallel (limited by the app-max-concurrency annotation, if configured). Set to single to disable parallel processing. In most situations there’s no reason to change this.parallel, single

Create a RabbitMQ server

You can run a RabbitMQ server locally using Docker:

  1. docker run -d --hostname my-rabbit --name some-rabbit rabbitmq:3

You can then interact with the server using the client port: localhost:5672.

The easiest way to install RabbitMQ on Kubernetes is by using the Helm chart:

  1. helm install rabbitmq stable/rabbitmq

Look at the chart output and get the username and password.

This will install RabbitMQ into the default namespace. To interact with RabbitMQ, find the service with: kubectl get svc rabbitmq.

For example, if installing using the example above, the RabbitMQ server client address would be:

rabbitmq.default.svc.cluster.local:5672

Related links

Last modified March 18, 2021: Merge pull request #1321 from dapr/aacrawfi/logos (9a399d5)