groupAction
  groupAction component: node group. It groups multiple nodes into a group, executes all nodes asynchronously, waits for all nodes to finish execution, merges the results of all nodes, and sends them to the next node. Similar to sub-rule chain
If the number of nodes that match Config.MatchNum is of the type specified by Config.MatchRelationType, then send the data to the Success chain, otherwise send it to the Failure chain.
# Configuration
| Field | Type | Required | Description | Default | 
|---|---|---|---|---|
| matchRelationType | string | No | Match the relationship type of the nodes in the group | Success | 
| matchNum | int | No | Match the number of nodes that meet the condition | 0 | 
| nodeIds | string | Yes | List of node IDs in the group, multiple IDs separated by , |  - | 
| timeout | int | No | Execution timeout, in seconds, default: 0 means no timeout | 0 | 
matchNum: number of nodes that match the condition
- Default 0, which means that all nodes in the group are of the type specified by 
matchRelationType, and will be sent to theSuccesschain, otherwise they will be sent to theFailurechain. - matchNum>0, which means that any match to 
matchNumnodes are of the type specified bymatchRelationType, and will be sent to theSuccesschain, otherwise they will be sent to theFailurechain. - matchNum>=len(nodeIds), which is equivalent to matchNum=0
 
# Relation Type
Success: Send the message to the
SuccesschainFailure: nodeIds is empty, execution timeout or node execution failure, send to the
Failurechainmetadata: Merge the metadata of each end node after processing, overwrite if the same key.
data: Wrap the messages of each end node after processing into a WrapperMsg array. WrapperMsg:
| Field | Type | Description | Default | 
|---|---|---|---|
| msg | types.RuleMsg | Message | None | 
| err | string | "" | |
| nodeId | string | The last processing node | "" | 
# Configuration example
//Note: The rule chain is triggered from the third node. firstNodeIndex=2
{
  "ruleChain": {
    "id": "rule01",
    "name": "Test rule chain",
    "root": true
  },
  "metadata": {
    "firstNodeIndex": 2,
    "nodes": [
      {
        "id": "s1",
        "type": "functions",
        "name": "Component 1",
        "debugMode": true,
        "configuration": {
          "functionName": "groupActionTest1"
        }
      },
      {
        "id": "s2",
        "type": "functions",
        "name": "Component 2",
        "debugMode": true,
        "configuration": {
          "functionName": "groupActionTest2"
        }
      },
      {
        "id": "group1",
        "type": "groupAction",
        "name": "Action group",
        "debugMode": true,
        "configuration": {
          "matchRelationType": "Success",
          "nodeIds": "s1,s2"
        }
      },
      {
        "id": "s3",
        "type": "log",
        "name": "Log",
        "debugMode": false,
        "configuration": {
          "jsScript": "return msg;"
        }
      }
    ],
    "connections": [
      {
        "fromId": "group1",
        "toId": "s3",
        "type": "Success"
      }
    ]
  }
}
 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