RuleGo RuleGo
🏠首页
  • 快速入门
  • 规则链
  • 标准组件
  • 扩展组件
  • 自定义组件
  • 可视化
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • 触发器
  • 高级主题
  • 性能
  • 标准组件
  • 扩展组件
  • 自定义组件
  • 组件市场
  • 概述
  • 快速入门
  • 路由
  • DSL
  • API
  • Options
  • 组件
🔥编辑器 (opens new window)
  • 可视化编辑器 (opens new window)
  • RuleGo-Server (opens new window)
  • ❓问答

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

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

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

  • 规则链

  • 标准组件

    • 标准组件概述
    • 过滤器

      • js脚本过滤器
      • 字段过滤器
        • 配置
        • Relation Type
        • 执行结果
        • 配置示例
        • 应用示例
      • 消息路由
      • js脚本路由
      • 过滤器组
      • 表达式过滤器
      • 并行网关
      • 条件分支
    • 动作

    • 转换器

    • 外部的

    • 流

  • 扩展组件

  • 自定义组件

  • 组件市场

  • 可视化

  • AOP

  • 触发器

  • 高级主题

  • RuleGo-Server

  • 问题

目录

字段过滤器

fieldFilter组件:字段过滤器。用于检查消息(msg)和元数据(metadata)中是否包含指定的字段,根据检查结果决定消息的路由方向(True或False链)。

# 配置

字段 类型 说明 默认值
checkAllKeys boolean 是否要求所有指定的字段都存在。true:全部存在才返回true;false:存在任一字段即返回true false
dataNames string 需要检查的msg字段名列表,多个字段用逗号分隔 无
metadataNames string 需要检查的metadata字段名列表,多个字段用逗号分隔 无

# Relation Type

  • True: 当字段检查通过时,消息将沿True链路径继续传递
  • False: 当字段检查不通过时,消息将沿False链路径继续传递
  • Failure: 组件执行出错时,消息将沿Failure链路径继续传递

# 执行结果

该组件是纯过滤组件,不会修改传入的msg、metadata和msgType内容。仅根据字段检查结果决定消息的路由方向。

# 配置示例

  {
    "id": "s1",
    "type": "fieldFilter",
    "name": "字段过滤",
    "configuration": {
      "checkAllKeys": true,
      "dataNames": "temperature",
      "metadataNames": "productType,name"
    }
  }
1
2
3
4
5
6
7
8
9
10

# 应用示例

如果msg包含temperature字段,则把消息推送到:http://192.168.136.26:9099/app1/api/msg,否则推送到:http://192.168.136.26:9099/app2/api/msg

{
  "ruleChain": {
    "id":"rule01",
    "name": "测试规则链",
    "root": true
  },
  "metadata": {
    "nodes": [
      {
        "id": "s1",
        "type": "fieldFilter",
        "name": "过滤",
        "configuration": {
          "dataNames": "temperature"
        }
      },
      {
        "id": "s2",
        "type": "restApiCall",
        "name": "推送数据-app2",
        "configuration": {
          "restEndpointUrlPattern": "http://192.168.136.26:9099/app1/api/msg",
          "requestMethod": "POST",
          "maxParallelRequestsCount": 200
        }
      },
      {
        "id": "s3",
        "type": "restApiCall",
        "name": "推送数据-app2",
        "configuration": {
          "restEndpointUrlPattern": "http://192.168.136.26:9099/app2/api/msg",
          "requestMethod": "POST",
          "maxParallelRequestsCount": 200
        }
      }
    ],
    "connections": [
      {
        "fromId": "s1",
        "toId": "s2",
        "type": "True"
      },
      {
        "fromId": "s1",
        "toId": "s3",
        "type": "False"
      }
    ]
  }
}
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
在 GitHub 上编辑此页 (opens new window)
上次更新: 2025/04/02, 01:29:50
js脚本过滤器
消息路由

← js脚本过滤器 消息路由→

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

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