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 Other
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
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
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: 2024/10/23, 10:13:01