---
schema_version: "1"
id: 64769426c9e11a8f12ec97174ac4349a9ac6711c0e17289702c6d5759ee8a3b2
title: Scatter-Gather  (<scatter-gather/>)
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/anypoint-code-builder/acb-component-scatter-gather.md
canonical_url: https://docs.mulesoft.com/anypoint-code-builder/acb-component-scatter-gather
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a743dbe03d41e759858f83c10af89bb428d70c3d5af419074b04ae99abcdb996
description: MuleSoft Documentation Site
latest: true
---
---
product: Anypoint Code Builder
version: master
---

# Scatter-Gather (<scatter-gather/>)

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Process a Mule event through two or more routes, and combine the results into a single event object.

## Component XML

This component supports the following XML structure:

```xml
<scatter-gather doc:name="Scatter-Gather"
  doc:id="24d159a9"
  timeout="0"
  target="myTarget"
  maxConcurrency="10">
    <route >
      <!-- one or more processors here -->
    </route>
    <route >
      <!-- one or more processors here -->
    </route>
</scatter-gather>
```

Scatter Gather (`<scatter-gather/>`) attributes are configurable through the UI and XML.

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Attribute Name</th><th>Attribute XML</th><th>Description</th></tr></thead><tbody><tr><td><p><strong>Scatter gather</strong> (default)</p></td><td><p><code>doc:name</code></p></td><td><div><div><p>Editable name for the component to display in the canvas.</p></div></div></td></tr><tr><td><p>N/A</p></td><td><p><code>doc:id</code></p></td><td><div><div><p>Automatically generated identifier for the component.</p></div></div></td></tr><tr><td><p><strong>Timeout</strong></p></td><td><p><code>timeout</code></p></td><td><div><div><p>Sets the timeout for responses from sent messages, in milliseconds. A value of <code>0</code> or less than <code>0</code> prevents a timeout. Defaults to <code>0</code>.</p></div></div></td></tr><tr><td><p><strong>Max concurrency</strong></p></td><td><p><code>maxConcurrency</code></p></td><td><div><div><p>Sets the maximum number of routes to run concurrently.</p></div><div><p>By default, all routes run in parallel. Setting this value to <code>1</code> makes the component process the routes sequentially.</p></div></div></td></tr><tr><td><p><strong>Collect list</strong></p></td><td><p>N/A</p></td><td><div><div><p>N/A</p></div></div></td></tr><tr><td><p><strong>Target Variable</strong></p></td><td><p><code>target</code></p></td><td><div><div><p>Name of the variable in which you want to store message data. Names can only include numbers, characters, and underscores. For example, hyphens are not allowed in the name. See <a href="https://docs.mulesoft.com/mule-runtime/latest/target-variables">Enrich Data with Target Variables</a> in the Mule documentation.</p></div></div></td></tr><tr><td><p><strong>Target Value</strong></p></td><td><p><code>targetValue</code></p></td><td><div><div><p>Value of the data to store in the target variable. By default, the value is the message payload (payload). The field accepts any value that a variable accepts: any supported data type, DataWeave expressions, the keywords <code>payload</code>, <code>attributes</code>, and <code>message</code>, but not the keyword <code>vars</code>. The default value is <code>#[payload]</code>.</p></div><div><p>See <a href="https://docs.mulesoft.com/mule-runtime/latest/target-variables">Enrich Data with Target Variables</a> in the Mule documentation.</p></div></div></td></tr></tbody></table>

`<route/>` is a child element of Scatter Gather.

<table><colgroup><col> <col></colgroup><thead><tr><th>Child Element</th><th>Description</th></tr></thead><tbody><tr><td><p><code>&lt;route/&gt;</code></p></td><td><div><div><p>Accepts one or more components as child elements for processing the Mule event. Multiple <code>&lt;route/&gt;</code> configurations are allowed.</p></div></div></td></tr></tbody></table>

## Error Handling

This component can throw the following errors:

- `MULE:ROUTING`

- `MULE:COMPOSITE_ROUTING`

If you configure a timeout for this component and a route does not complete processing before the
timeout expires, the route throws a `MULE:TIMEOUT` error. Mule handles this error as it handls other
errors generated from a route: After each route completes (either by processing successfully or by
throwing a `MULE:TIMEOUT` error), the successful results and errors are collected into the
`MULE:COMPOSITE_ROUTING` error and then processed within a configured error handler component.

## See Also

- [Core Components](https://docs.mulesoft.com/mule-runtime/latest/about-components)

- [How Transactions Affect Scopes and Routers](https://docs.mulesoft.com/mule-runtime/latest/transaction-management#tx_scopes_routers)

- [Error Handlers](https://docs.mulesoft.com/mule-runtime/latest/error-handling)

- [Try Scope](https://docs.mulesoft.com/mule-runtime/latest/try-scope-concept)

- [Mule Event Structure](https://docs.mulesoft.com/mule-runtime/latest/about-mule-event)
