Trigger
# Introduction
RuleGo
triggers the execution of rule chains in two ways: automatically and manually.
- The automatic trigger is called: Endpoint (Input Endpoint). You can add endpoint configurations to the rule chain DSL file, dynamically set input endpoints, and trigger the execution of the rule chain through external trigger sources. For example, set up access points such as accepting HTTP requests, MQTT\kafka subscriptions, scheduling, etc.
At present, this version cannot set endpoint reuse in the rule chain DSL. For HTTP endpoints, if the port is occupied, they cannot be used again. Solution: Endpoint and rule chain run separately. [Endpoint DSL] (/en/pages/390ad7/)
Example:
Accept /api/v1/test API requests, then hand them over to the rule chain node for processing:
{
"ruleChain": {
"id": "withHttpEndpoint",
"name": "Built-in Http Input Endpoint Rule Chain"
},
"metadata": {
"endpoints":[
{
"id": "e1",
"type": "http",
"name": "http server",
"configuration": {
"server": ":9090"
},
"routers": [
{
"id":"r1",
"params": [
"POST"
],
"from": {
"path": "/api/v1/test",
"configuration": {
}
},
"to": {
"wait": true,
"processors": ["responseToBody"]
}
}
]
}
],
"nodes": [
{
"type": "jsFilter",
"name": "Filter",
"debugMode": true,
"configuration": {
"jsScript": "return msg.temperature>10;"
}
}
],
"connections": [
]
}
}
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
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
Trigger the rule chain logic every 1 second:
{
"ruleChain": {
"id": "withScheduleEndpoint",
"name": "Built-in Scheduled Input Endpoint Rule Chain"
},
"metadata": {
"endpoints":[
{
"id": "e2",
"type": "schedule",
"name": "schedule",
"processors": ["testPrint"],
"routers": [
{
"from": {
"path": "*/1 * * * * *"
}
}
]
}
],
"nodes": [
{
"id":"s1",
"type": "jsFilter",
"name": "Filter",
"debugMode": true,
"configuration": {
"jsScript": "return msg.temperature>10;"
}
}
],
"connections": [
]
}
}
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
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
- For manual triggering of the rule chain, refer to: Execute Rule Chain
Edit this page on GitHub (opens new window)
Last Updated: 2024/10/23, 10:13:01