mirror of https://github.com/dapr/docs.git
updated rabbitmq documentation
This commit is contained in:
parent
fd923fe994
commit
c7a43e5d5d
|
|
@ -5,7 +5,53 @@ linkTitle: "RabbitMQ"
|
||||||
description: "Detailed documentation on the RabbitMQ pubsub component"
|
description: "Detailed documentation on the RabbitMQ pubsub component"
|
||||||
---
|
---
|
||||||
|
|
||||||
## Setup RabbitMQ
|
## Format
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: dapr.io/v1alpha1
|
||||||
|
kind: Component
|
||||||
|
metadata:
|
||||||
|
name: rabbitmq-pubsub
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
type: pubsub.rabbitmq
|
||||||
|
version: v1
|
||||||
|
metadata:
|
||||||
|
- name: host
|
||||||
|
value: "amqp://localhost:5672"
|
||||||
|
- name: durable
|
||||||
|
value: "false"
|
||||||
|
- name: deletedWhenUnused
|
||||||
|
value: "false"
|
||||||
|
- name: autoAck
|
||||||
|
value: "false"
|
||||||
|
- name: deliveryMode
|
||||||
|
value: "0"
|
||||||
|
- name: requeueInFailure
|
||||||
|
value: "false"
|
||||||
|
- name: prefetchCount
|
||||||
|
value: "0"
|
||||||
|
```
|
||||||
|
{{% alert title="Warning" color="warning" %}}
|
||||||
|
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
|
||||||
|
{{% /alert %}}
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Required | Details | Example |
|
||||||
|
|--------------------|:--------:|---------|---------|
|
||||||
|
| host | Y | Connection-string for the rabbitmq host | `amqp://user:pass@localhost:5672`
|
||||||
|
| durable | N | Whether or not to use [durable](https://www.rabbitmq.com/queues.html#durability) queues. Defaults to `"false"` | `"true"`, `"false"`
|
||||||
|
| deletedWhenUnused | N | Whether or not the queue sohuld be configured to [auto-delete](https://www.rabbitmq.com/queues.html) Defaults to `"false"` | `"true"`, `"false"`
|
||||||
|
| autoAck | N | Whether or not the queue consumer should [auto-ack](https://www.rabbitmq.com/confirms.html) messages. Defaults to `"false"` | `"true"`, `"false"`
|
||||||
|
| deliveryMode | N | Persistence mode when publishing messages. Defaults to `"0"`. RabbitMQ treats `"2"` as persistent, all other numbers as non-persistent | `"0"`, `"2"`
|
||||||
|
| requeueInFailure | N | Whether or not to requeue when sending a [negative acknolwedgement](https://www.rabbitmq.com/nack.html) in case of a failure. Defaults to `"false"` | `"true"`, `"false"`
|
||||||
|
| prefetchCount | N | Number of messages to [prefecth](https://www.rabbitmq.com/consumer-prefetch.html). Consider changing this to a non-zero value for production environments. Defaults to `"0"`, which means that all available messages will be prefected. | `"2"`
|
||||||
|
| reconnectWait | N | How long to wait (in seconds) before reconnecting if a connection failure occurs | `"0"`
|
||||||
|
|
||||||
|
## Further reading
|
||||||
|
|
||||||
|
### How to set up RabbitMQ
|
||||||
|
|
||||||
{{< tabs "Self-Hosted" "Kubernetes" >}}
|
{{< tabs "Self-Hosted" "Kubernetes" >}}
|
||||||
|
|
||||||
|
|
@ -38,39 +84,6 @@ For example, if installing using the example above, the RabbitMQ server client a
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
## Create a Dapr component
|
|
||||||
|
|
||||||
The next step is to create a Dapr component for RabbitMQ.
|
|
||||||
|
|
||||||
Create the following YAML file named `rabbitmq.yaml`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
apiVersion: dapr.io/v1alpha1
|
|
||||||
kind: Component
|
|
||||||
metadata:
|
|
||||||
name: <NAME>
|
|
||||||
namespace: <NAMESPACE>
|
|
||||||
spec:
|
|
||||||
type: pubsub.rabbitmq
|
|
||||||
version: v1
|
|
||||||
metadata:
|
|
||||||
- name: host
|
|
||||||
value: <REPLACE-WITH-HOST> # Required. Example: "amqp://rabbitmq.default.svc.cluster.local:5672", "amqp://localhost:5672"
|
|
||||||
- name: durable
|
|
||||||
value: <REPLACE-WITH-DURABLE> # Optional. Default: "false"
|
|
||||||
- name: deletedWhenUnused
|
|
||||||
value: <REPLACE-WITH-DELETE-WHEN-UNUSED> # Optional. Default: "false"
|
|
||||||
- name: autoAck
|
|
||||||
value: <REPLACE-WITH-AUTO-ACK> # Optional. Default: "false"
|
|
||||||
- name: deliveryMode
|
|
||||||
value: <REPLACE-WITH-DELIVERY-MODE> # Optional. Default: "0". Values between 0 - 2.
|
|
||||||
- name: requeueInFailure
|
|
||||||
value: <REPLACE-WITH-REQUEUE-IN-FAILURE> # Optional. Default: "false".
|
|
||||||
```
|
|
||||||
|
|
||||||
{{% alert title="Warning" color="warning" %}}
|
|
||||||
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
|
|
||||||
{{% /alert %}}
|
|
||||||
|
|
||||||
## Apply the configuration
|
## Apply the configuration
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue