BeanstalkdWorker
x/beanstalkdWorker
组件:v0.29.0+ Beanstalkd消费端,支持以下操作Delete、Release、Bury、KickJob、Touch、Peek、ReserveJob、StatsJob、Stats、ListTubes。
需要额外引入扩展库:rulego-components (opens new window) 需要配置组件连接复用 (opens new window),不同节点之间通过组件连接复用保持客户端实例一致(Beanstalkd客户端订阅消息后,会锁死当前客户端,其他客户端无法对消息操作)
# 配置
字段 | 类型 | 说明 | 默认值 |
---|---|---|---|
server | string | Beanstalkd服务器地址 | 127.0.0.1:11300 |
tube | string | 必填,Tube名称允许使用 ${} 占位符变量 | default |
cmd | string | 必填,命令名称,支持Delete Release Bury KickJob Touch Peek ReserveJob StatsJob Stats ListTubes | Stats |
jobId | string | JobId根据命令选填,允许使用 ${} 占位符变量,Delete、Release、Bury、KickJob、Touch、Peek、ReserveJob、StatsJob命令参数 | |
pri | string | 优先级,允许使用 ${} 占位符变量,Release、Bury命令参数 | |
delay | string | 延迟时间,允许使用 ${} 占位符变量,Release命令参数 |
# 配置示例
{
"ruleChain": {
"id": "TCh3Jts0IroQ",
"name": "Beastalkd Enpoint测试",
"debugMode": false,
"root": true,
"disabled": false,
"additionalInfo": {
"createTime": "2025/01/16 09:34:19",
"description": "",
"layoutX": "280",
"layoutY": "280",
"message": "the rule chain has been disabled",
"updateTime": "2025/01/16 21:47:46",
"username": "admin"
}
},
"metadata": {
"endpoints": [
{
"id": "node_2",
"additionalInfo": {
"layoutX": 480,
"layoutY": 380
},
"type": "endpoint/beanstalkdTubeset",
"name": "Pop Job",
"debugMode": false,
"configuration": {
"server": "ref://local_beanstalkdWorker",
"timeout": "5m",
"tubesets": [
"foo",
"bar"
]
},
"processors": null,
"routers": [
{
"id": "5XCMosX5GVY3",
"params": [],
"from": {
"path": "*",
"configuration": null,
"processors": []
},
"to": {
"path": "TCh3Jts0IroQ:node_4",
"configuration": null,
"wait": false,
"processors": []
}
}
]
}
],
"nodes": [
{
"id": "node_4",
"additionalInfo": {
"layoutX": 780,
"layoutY": 320
},
"type": "log",
"name": "Log",
"debugMode": true,
"configuration": {
"jsScript": "return 'Incoming message:\n' + JSON.stringify(msg) + '\nIncoming metadata:\n' + JSON.stringify(metadata);"
}
},
{
"id": "node_9",
"additionalInfo": {
"layoutX": 1040,
"layoutY": 240
},
"type": "x/beanstalkdWorker",
"name": "Del",
"debugMode": true,
"configuration": {
"cmd": "Delete",
"jobId": "${id}",
"server": "ref://local_beanstalkdWorker",
"tube": "${tube}"
}
}
],
"connections": [
{
"fromId": "node_4",
"toId": "node_9",
"type": "Success"
}
]
}
}
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Relation Type
- Success: 执行成功,把消息发送到
Success
链 - Failure: 执行失败,把消息发送到
Failure
链
# 执行结果
参考Beanstkd执行命令返回值,被转换为 RuleMsg
格式并发送到规则链:
- data:消息内容
- dataType:JSON
- type:默认为空
- metadata:消息元数据,包括
id
、tube
等信息
在 GitHub 上编辑此页 (opens new window)
上次更新: 2025/01/20, 08:24:31