RuleGo RuleGo
🏠首页
  • 快速入门
  • 规则链
  • 标准组件
  • 扩展组件
  • 自定义组件
  • 可视化
  • RuleGo-Server
  • AOP
  • 触发器
  • 高级主题
  • 性能
  • 标准组件
  • 扩展组件
  • 自定义组件
  • 流式计算
  • 组件市场
  • 概述
  • 快速入门
  • 路由
  • DSL
  • API
  • Options
  • 组件
🔥编辑器 (opens new window)
  • 可视化编辑器 (opens new window)
  • RuleGo-Server (opens new window)
  • 🌊StreamSQL
  • 🤖智能体框架
  • 🦀TPCLAW 智能体平台 (opens new window)
  • ❓问答

    • FAQ
💖支持
👥加入社区
  • Github (opens new window)
  • Gitee (opens new window)
  • GitCode (opens new window)
  • 更新日志 (opens new window)
  • English
  • 简体中文
🏠首页
  • 快速入门
  • 规则链
  • 标准组件
  • 扩展组件
  • 自定义组件
  • 可视化
  • RuleGo-Server
  • AOP
  • 触发器
  • 高级主题
  • 性能
  • 标准组件
  • 扩展组件
  • 自定义组件
  • 流式计算
  • 组件市场
  • 概述
  • 快速入门
  • 路由
  • DSL
  • API
  • Options
  • 组件
🔥编辑器 (opens new window)
  • 可视化编辑器 (opens new window)
  • RuleGo-Server (opens new window)
  • 🌊StreamSQL
  • 🤖智能体框架
  • 🦀TPCLAW 智能体平台 (opens new window)
  • ❓问答

    • FAQ
💖支持
👥加入社区
  • Github (opens new window)
  • Gitee (opens new window)
  • GitCode (opens new window)
  • 更新日志 (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • 快速入门

  • 规则链

  • 标准组件

  • 扩展组件

    • 扩展组件概述
    • 过滤器

    • 动作

    • 转换器

    • 外部的

    • ai

    • CI

    • IoT

    • 流式计算

    • 服务发现

      • 服务发现组件概览
      • 服务调用

      • 配置

        • Nacos 配置获取
        • Nacos 配置监听端点
        • Nacos 配置写入
          • 配置
          • 行为
          • 输出
          • 示例
            • 读-改-写(只改某个字段)
          • 关联组件
    • 文件

  • 自定义组件

  • 组件市场

  • 可视化

  • AOP

  • 触发器

  • 高级主题

  • 智能体框架

  • RuleGo-Server

  • 问题

目录

Nacos 配置写入

x/nacosConfigSet 组件:全量写入(发布)nacos 配置——不存在则创建、存在则覆盖。成功走 Success、失败走 Failure。

需要额外引入扩展库:rulego-components-discovery (opens new window)

# 配置

继承 公共连接配置,额外字段:

字段 类型 说明 默认值
dataId string 配置 Data ID 无(必填)
group string 配置分组 DEFAULT_GROUP
content string 配置内容,支持 ${msg.xx} 空
format string 配置格式:json/yaml/properties/text json

# 行为

  • 全量覆盖:nacos 配置以文本存储,写入即整段替换原内容(nacos 本身不感知内部结构,无字段级 API)。
  • 模板:content 支持 ${msg.xx} 动态渲染。
  • 改某个字段:需「读-改-写」组合,见下文示例。

# 输出

写入成功后 msg 原样向 Success 流转(节点不读回内容)。

# 示例

全量写入固定配置:

{
  "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

# 读-改-写(只改某个字段)

x/nacosConfigGet 读原配置 → jsTransform 解析改字段 → x/nacosConfigSet 全量写回:

{
  "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

读-改-写非原子,并发写同一 dataId 可能「后写覆盖前写」;配置变更通常低频,风险很小。

# 关联组件

  • 服务调用:x/nacosServiceCall
  • 配置读取:x/nacosConfigGet
  • 配置变更监听:endpoint/nacos
在 GitHub 上编辑此页 (opens new window)
上次更新: 2026/08/01, 05:05:14
Nacos 配置监听端点
文件组件

← Nacos 配置监听端点 文件组件→

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

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