# RabbitMQ

Type: `bindings.rabbitmq`

Status: stable

Reference: https://docs.dapr.io/reference/components-reference/supported-bindings/rabbitmq/

## Example

```
apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
  name: <name>
spec:
  type: bindings.rabbitmq
  version: v1
  metadata:
    # RabbitMQ host address.
    - name: host
      value: "amqp://[username][:password]@host.domain[:port], amqps://[username][:password]@host.domain[:port]"
    # Indicates the direction of the binding component.
    - name: direction
      value: "input,output"
    # RabbitMQ queue name.
    - name: queueName
      value: "myqueue"
    # Certificate authority certificate, required for using TLS. (Optional)
    #- name: caCert
    #  value: | 
    #    -----BEGIN CERTIFICATE-----
    #    <base64-encoded DER>
    #    -----END CERTIFICATE-----
    # Client certificate, required when "authType" is "mtls". (Optional)
    #- name: clientCert
    #  value: | 
    #    -----BEGIN CERTIFICATE-----
    #    <base64-encoded DER>
    #    -----END CERTIFICATE-----
    # Client key, required when "authType" is "mtls". (Optional)
    #- name: clientKey
    #  value: | 
    #    -----BEGIN PRIVATE KEY-----
    #    <base64-encoded DER>
    #    -----END PRIVATE KEY-----
    # The content type of the message. (Optional)
    #- name: contentType
    #  value: "“text/plain”"
    # Enables or disables auto-delete. (Optional)
    #- name: deleteWhenUnused
    #  value: "false"
    # Tells RabbitMQ to persist message in storage. (Optional)
    #- name: durable
    #  value: "false"
    # If true, the topic is treated as exclusive. (Optional)
    #- name: exclusive
    #  value: "false"
    # With TLS, should the username be taken from an additional field (e.g. CN.) See RabbitMQ Authentication Mechanisms. (Optional)
    #- name: externalSasl
    #  value: "false"
    # Parameter to set the priority queue. If this parameter is omitted, queue will be created as a general queue instead of a priority queue. Value is between 1 and 255. (Optional)
    #- name: maxPriority
    #  value: "1"
    # Set the Channel Prefetch Setting (QoS). If this parameter is omitted, QoS would set value to 0 as no limit. (Optional)
    #- name: prefetchCount
    #  value: "0"
    # Represents the duration in seconds that the client should wait before attempting to reconnect to the server after a disconnection occurs. (Optional)
    #- name: reconnectWaitInSeconds
    #  value: "5"
    # Specifies a custom route for incoming events. (Optional)
    #- name: route
    #  value: "/custom-path"
    # Set the default message time to live at RabbitMQ queue level. If this parameter is omitted, messages won't expire, continuing to exist on the queue until processed. (Optional)
    #- name: ttl
    #  value: "60s"

```

## Binding information

Input Binding: yes

Output Binding: yes

### Output Binding operations:

- `create`: Publish a new message in the queue.

## Authentication profiles

Available authentication profiles:

- Connection string

### Connection string

Use a connection string

#### `host`

**Required** - RabbitMQ host address.

Example value: `amqp://[username][:password]@host.domain[:port], amqps://[username][:password]@host.domain[:port]`

## Metadata

### `direction` (string)

**Required** - Indicates the direction of the binding component.

Example value: `input,output`

Allowed values:

- input

- output

- input,output

Documentation: https://docs.dapr.io/reference/api/bindings\_api/#binding-direction-optional

### `queueName` (string)

**Required** - RabbitMQ queue name.

Example value: `myqueue`

### `caCert` (string)

Certificate authority certificate, required for using TLS.

Example value:

```
-----BEGIN CERTIFICATE-----
<base64-encoded DER>
-----END CERTIFICATE-----
```

### `clientCert` (string)

Client certificate, required when "authType" is "mtls".

Example value:

```
-----BEGIN CERTIFICATE-----
<base64-encoded DER>
-----END CERTIFICATE-----
```

### `clientKey` (string)

Client key, required when "authType" is "mtls".

Example value:

```
-----BEGIN PRIVATE KEY-----
<base64-encoded DER>
-----END PRIVATE KEY-----
```

### `contentType` (string)

The content type of the message.

Default value: `“text/plain”`

Example value: `text/plain, application/cloudevent+json`

### `deleteWhenUnused` (bool)

Enables or disables auto-delete.

Default value: `false`

Example value: `true, false`

### `durable` (bool)

Tells RabbitMQ to persist message in storage. Used for output binding direction.

Default value: `false`

Example value: `true, false`

### `exclusive` (bool)

If true, the topic is treated as exclusive.

Default value: `false`

Example value: `true, false`

### `externalSasl` (string)

With TLS, should the username be taken from an additional field (e.g. CN.) See RabbitMQ Authentication Mechanisms.

Default value: `false`

Example value: `true, false`

RabbitMQ Authentication Mechanisms: https://www.rabbitmq.com/access-control.html#mechanisms

### `maxPriority` (number)

Parameter to set the priority queue. If this parameter is omitted, queue will be created as a general queue instead of a priority queue. Value is between 1 and 255.

Default value: `1`

Example value: `1, 10`

RabbitMQ Priority Queue Support: https://www.rabbitmq.com/priority.html

### `prefetchCount` (number)

Set the Channel Prefetch Setting (QoS). If this parameter is omitted, QoS would set value to 0 as no limit. Used for input binding direction.

Default value: `0`

Example value: `0`

RabbitMQ Channel Prefetch Setting (QoS): https://www.rabbitmq.com/confirms.html#channel-qos-prefetch

### `reconnectWaitInSeconds` (number)

Represents the duration in seconds that the client should wait before attempting to reconnect to the server after a disconnection occurs.

Default value: `5`

Example value: `5, 10`

### `route` (string)

Specifies a custom route for incoming events.

Example value: `/custom-path`

Documentation: https://docs.dapr.io/developing-applications/building-blocks/bindings/howto-triggers/#specify-a-custom-route

### `ttl` (duration)

Set the default message time to live at RabbitMQ queue level. If this parameter is omitted, messages won't expire, continuing to exist on the queue until processed. Used for output binding direction.

Example value: `60s`

RabbitMQ Time-To-Live and Expiration: https://www.rabbitmq.com/ttl.html
