MQTT Endpoint
Mqtt Endpoint is used to create and start MQTT receiving service, it can subscribe to different topic data, and then route it to different rule chains for processing.
# Type
endpoint/mqtt
# Startup configuration
This component allows the reuse of shared connection clients through the server field. See Component Connection Reuse for reference.
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
| server | string | Yes | mqtt broker address | - |
| username | string | No | username | 0 |
| Password | string | No | password | - |
| qOS | int | No | QOS | 0 |
| cleanSession | bool | No | CleanSession | false |
| clientID | string | No | client ID | default random number |
| cAFile | string | No | CA file path | - |
| certFile | string | No | Cert file path | - |
| certKeyFile | string | No | CertKey file path | - |
# Response
Before exchange.Out.SetBody response, you need to specify the responseTopic parameter through exchange.Out.Headers() or exchange.Out.Msg.Metadata, and the component will respond to the specified topic data:
exchange.Out.GetMsg().Metadata.PutValue("responseTopic", "device.msg.response")
// or
exchange.Out.Headers().Add("responseTopic", "device.msg.response")
exchange.Out.SetBody([]byte("ok"))
1
2
3
4
2
3
4
Response parameter configuration:
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
| responseTopic | string | Yes | Response topic | - |
| responseQos | int | No | Response QOS | 0 |
# Examples
The following are example codes using endpoint:
Edit this page on GitHub (opens new window)
Last Updated: 2025/09/02, 11:02:23