字段过滤器
fieldFilter
组件:字段过滤器。可以对msg和metadata字段进行过滤。
# 配置
字段 | 类型 | 说明 | 默认值 |
---|---|---|---|
checkAllKeys | boolean | 是否满足所有field key存在 | false |
dataNames | string | msg data字段key,多个与逗号隔开 | 无 |
metadataNames | string | metadata字段key,多个与逗号隔开 | 无 |
# 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
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
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)
上次更新: 2024/10/23, 10:13:01