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

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

    • Config
    • Options
    • Share data
    • Execute Rule Chain
    • Component Configuration Variables
      • Component Configuration Variables
        • Global Variables
        • Runtime Variables
        • Example
    • Component Connection Reuse
    • Performance
    • Other
  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

目录

Component Configuration Variables

# Component Configuration Variables

In certain scenarios, it’s necessary to uniformly modify component configurations or dynamically replace them during component runtime. You can achieve this by using built-in variables to substitute component configurations. The syntax is as follows: ${key} or ${key.subKey}.

# Global Variables

Global variables are executed for replacement logic during component initialization (when the component's Init method is executed), including the following variables:

  • global variable: Access values from config.Properties, for example, ${global.key}.
  • vars variable: Access values from rule chain vars, for example, ${vars.key}.

Global Variables: All component configuration fields support variable substitution.

# Runtime Variables

Runtime Variables are executed for replacement logic during component runtime (when the component's OnMsg method is executed), including the following variables:

  • id variable: Access the message ID.
  • ts variable: Access the message timestamp.
  • data variable: Access the original message content.
  • msg variable: Access the transformed message data. If the message's dataType is JSON, you can access fields using ${msg.key}.
  • metadata variable: Access message metadata, e.g., ${metadata.key}.
  • type variable: Access the message type.
  • dataType variable: Access the data type.

Runtime Variables: Only specific component configuration fields, as indicated, support variable substitution.

# Example

{
  "ruleChain": {
	"id":"rule01",
    "name": "test",
    "configuration": {
      "vars": {
        "topicPrefix":"/device/msg"
      }
    }
  },
  "metadata": {
    "nodes": [
      {
        "id": "s2",
        "type": "mqttClient",
        "name": "push data",
        "configuration": {
          "server": "${global.mqttServer}",
          "topic": "${vars.topicPrefix}/${metadata.deviceId}"
        }
      }
    ],
    "connections": [
      {
      }
    ]
  }
}
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
Edit this page on GitHub (opens new window)
Last Updated: 2025/04/02, 01:29:50
Execute Rule Chain
Component Connection Reuse

← Execute Rule Chain Component Connection Reuse→

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

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