RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-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)
  • StreamSQL
  • AI Agent Framework
  • TPCLAW Agent Platform (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
  • 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)
  • StreamSQL
  • AI Agent Framework
  • TPCLAW Agent Platform (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

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

    • Introduction
    • Use Cases
    • Quick Start
    • Dynamic Refresh Rule Chain
  • Rule Chain

  • Standard Components

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • Agent Framework

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

  • StreamSQL

目录

Nacos Config Set

x/nacosConfigSet: writes (publishes) config to nacos — creates if absent, overwrites if present. Routes to Success on success, Failure on error.

Requires extension library: rulego-components-discovery (opens new window)

# Configuration

Inherits Common Connection Config. Extra fields:

Field Type Description Default
dataId string Config Data ID none (required)
group string Config group DEFAULT_GROUP
content string Config content, supports ${msg.xx} empty
format string Config format: json/yaml/properties/text json

# Behavior

  • Full overwrite: nacos stores config as text; writing replaces the whole content (nacos is not structure-aware; no field-level API).
  • Template: content supports ${msg.xx} dynamic rendering.
  • Patch one field: use a read-modify-write chain, see below.

# Output

On success the msg flows to Success unchanged (the node does not read back).

# Examples

Write a fixed config:

{
  "id": "set_cfg",
  "type": "x/nacosConfigSet",
  "configuration": {
    "server": "127.0.0.1:8848",
    "dataId": "app.json",
    "group": "DEFAULT_GROUP",
    "content": "{\"featureX\":true}",
    "format": "json"
  }
}
1
2
3
4
5
6
7
8
9
10
11

# Read-modify-write (patch one field)

x/nacosConfigGet reads → jsTransform parses & patches → x/nacosConfigSet writes back:

{
  "ruleChain": {"name": "config-patch", "root": true},
  "metadata": {
    "nodes": [
      {"id": "g", "type": "x/nacosConfigGet", "configuration": {
        "server": "127.0.0.1:8848", "dataId": "app.json"}},
      {"id": "p", "type": "jsTransform", "configuration": {
        "jsScript": "var c=JSON.parse(msg); c.featureX=true; return {msg:JSON.stringify(c),metadata:metadata,msgType:msgType};"}},
      {"id": "s", "type": "x/nacosConfigSet", "configuration": {
        "server": "ref://g", "dataId": "app.json", "format": "json", "content": "${msg}"}}
    ],
    "connections": [
      {"fromId": "g", "toId": "p", "type": "Success"},
      {"fromId": "p", "toId": "s", "type": "Success"}
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Read-modify-write is not atomic; concurrent writes to the same dataId may suffer last-write-wins. Config changes are usually low-frequency, so the risk is small.

# Related

  • Service call: x/nacosServiceCall
  • Config read: x/nacosConfigGet
  • Config listen: endpoint/nacos
Edit this page on GitHub (opens new window)
Last Updated: 2026/08/01, 05:05:14
Theme by Vdoing | Copyright © 2023-2026 RuleGo Team | Apache 2.0 License

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