Scatter Gather can execute multiple tasks in parallel. In this component, you can add multiple branches and configure a subflow in each branch to execute a task independently.
Parameter | Data Type | Description | Required | Default Value |
---|---|---|---|---|
Maximum parallelism | int | Maximum number of tasks executed in parallel. Value range: 2–8. The actual parallelism is the lesser value between the number of branches and the maximum parallelism. | Yes | 4 |
Root message | string | The root message is a variable, which stores the message of the main flow. You need to enter a variable name. You can enter msg.vars.get('#root message name#').payload to access the payload data of the main flow. If the default value rootMessage is used, you can use msg.vars.get('rootMessage').payload to access the payload data of the main flow in the subflow. |
Yes | rootMessage |
None.
message
input to the subflowmessage Attribute |
Value |
---|---|
payload | This attribute inherits the payload in message of the main flow. |
error | Null. |
attribute | This attribute inherits the attribute in message of the main flow. |
variable | This attribute inherits the variable of the main flow. |
The output result of Scatter Gather doesn't contain the variable
variable used in the processing logic but only the data in payload
.
The output payload
is of dict
type and aggregates the processing result of each branch.
The message
output by the component is as detailed below:
message Attribute |
Value |
---|---|
payload | This attribute is of dict type. key is the branch number, which starts from 1 . value is the branch execution result (the payload output by the last component). |
error |
|
attribute | The value is the same as that of the input attribute . |
variable | The value is the same as that of the input variable. |
We recommend you use Scatter Gather to execute different tasks in parallel. For example, if you need to query the customer and product information based on the user order data, you can configure two branches to query the two types of information respectively.
payload
is a dictionary containing two keys.1
represents the result of the first branch, i.e., the queried customer information, and key 2
represents the result of the second branch, i.e., the queried product information.
Was this page helpful?