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

      • jsFilter
      • fieldFilter
      • msgTypeSwitch
        • Configuration
        • Relation Type
        • Execution result
        • Configuration example
        • Application example
      • jsSwitch
      • groupFilter
      • exprFilter
      • fork
      • Switch
    • action

    • transform

    • external

    • flow

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

目录

msgTypeSwitch

msgTypeSwitch component: message routing. Routes the incoming message type (msgType) to one or more output chains.

# Configuration

None

# Relation Type

Connect to the next or multiple nodes by msgType, if there is no matching node, the Default matching node will be used.

# Execution result

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

# Configuration example

{
  "id": "s1",
  "type": "msgTypeSwitch",
  "name": "Filter"
}
1
2
3
4
5

# Application example

Route to different nodes for processing by msgType.

{
  "ruleChain": {
    "id":"rule01",
    "name": "Test rule chain-msgTypeSwitch",
    "root": true
  },
  "metadata": {
    "nodes": [
      {
        "id": "s1",
        "type": "msgTypeSwitch",
        "name": "Filter"
      },
      {
        "id": "s2",
        "type": "log",
        "name": "Log 1",
        "configuration": {
          "jsScript": "return 'handle msgType='+ msgType+':s2';"
        }
      },
      {
        "id": "s3",
        "type": "log",
        "name": "Log 2",
        "configuration": {
          "jsScript": "return 'handle msgType='+ msgType+':s3';"
        }
      },
      {
        "id": "s4",
        "type": "log",
        "name": "Log 3",
        "configuration": {
          "jsScript": "return 'handle msgType='+ msgType+':s4';"
        }
      }
    ],
    "connections": [
      {
        "fromId": "s1",
        "toId": "s2",
        "type": "TEST_MSG_TYPE1"
      },
      {
        "fromId": "s1",
        "toId": "s3",
        "type": "TEST_MSG_TYPE1"
      },
      {
        "fromId": "s1",
        "toId": "s4",
        "type": "TEST_MSG_TYPE2"
      }
    ]
  }
}
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
52
53
54
55
56
57
Edit this page on GitHub (opens new window)
Last Updated: 2025/04/02, 01:29:50
fieldFilter
jsSwitch

← fieldFilter jsSwitch→

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

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