RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • Quick Start

  • Rule Chain

  • Standard Components

    • Standard Components Overview
    • filter

    • action

    • transform

    • external

      • restApiCall
      • mqttClient
        • Configuration
        • Relation Type
        • Execution result
        • Configuration example
        • Application example
      • sendEmail
      • dbClient
      • ssh
      • net
    • flow

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

目录

mqttClient

mqttClient component: mqtt client. Publish the current message data to the specified topic of the mqtt broker.

# Configuration

This component allows the reuse of shared connection clients through the server field. See Component Connection Reuse for reference.

Field Type Description Default value
topic string Publish topic, can using Component Configuration Variables. None
server string mqtt broker address None
username string Username None
password string Password None
maxReconnectInterval time.Duration Reconnect interval, supports configuration in the form of 10s, 1m, etc. None
qos int qos None
cleanSession bool Whether to clean session false
clientID string Client Id Random ID
CAFile string Configure to use ssl connection to mqtt broker None
CertFile string Configure to use ssl connection to mqtt broker None
CertKeyFile string Configure to use ssl connection to mqtt broker None

# Relation Type

  • Success: Execution successful, send the message to the Success chain
  • Failure: Execution failed, send the message to the Failure chain

# Execution result

This component will not change the content of msg, metadata and msgType.

# Configuration example

   {
    "id": "s2",
    "type": "mqttClient",
    "name": "Push data to mqtt Broker",
    "configuration": {
      "server": "127.0.0.1:1883",
      "topic": "/device/msg/${deviceId}"
    }
  }
1
2
3
4
5
6
7
8
9

# Application example

Application example reference: mqttClient (opens new window)

{
  "ruleChain": {
	"id":"rule01",
    "name": "Test rule chain",
    "root": true
  },
  "metadata": {
    "nodes": [
       {
        "id": "s1",
        "type": "jsTransform",
        "name": "Transform",
        "configuration": {
          "jsScript": "metadata['name']='test02';\n metadata['deviceId']='id01';\n msg['addField']='addValue2'; return {'msg':msg,'metadata':metadata,'msgType':msgType};"
        }
      },
      {
        "id": "s2",
        "type": "mqttClient",
        "name": "Push data to mqtt Broker",
        "configuration": {
          "server": "127.0.0.1:1883",
          "topic": "/device/msg/${deviceId}"
        }
      }
    ],
    "connections": [
      {
        "fromId": "s1",
        "toId": "s2",
        "type": "Success"
      }
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Edit this page on GitHub (opens new window)
Last Updated: 2025/04/02, 01:29:50
restApiCall
sendEmail

← restApiCall sendEmail→

Theme by Vdoing | Copyright © 2023-2025 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式