docs/daprdocs/content/en/reference/components-reference/supported-bindings/mqtt.md

1.8 KiB

type title linkTitle description aliases
docs MQTT binding spec MQTT Detailed documentation on the MQTT binding component
/operations/components/setup-bindings/supported-bindings/mqtt/

Component format

To setup MQTT binding create a component of type bindings.mqtt. See [this guide]({{< ref "howto-bindings.md#1-create-a-binding" >}}) on how to create and apply a binding configuration.

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: <NAME>
  namespace: <NAMESPACE>
spec:
  type: bindings.mqtt
  version: v1
  metadata:
  - name: url
    value: mqtt[s]://[username][:password]@host.domain[:port]
  - name: topic
    value: topic1

{{% 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 %}}

Spec metadata fields

Field Required Binding support Details Example
url Y Input/Output The MQTT broker url "mqtt[s]://[username][:password]@host.domain[:port]"
topic Y Input/Output The topic to listen on or send events to "mytopic"

Binding support

This component supports both input and output binding interfaces.

This component supports output binding with the following operations:

  • create
  • [Basic schema for a Dapr component]({{< ref component-schema >}})
  • [Bindings building block]({{< ref bindings >}})
  • [How-To: Trigger application with input binding]({{< ref howto-triggers.md >}})
  • [How-To: Use bindings to interface with external resources]({{< ref howto-bindings.md >}})
  • [Bindings API reference]({{< ref bindings_api.md >}})