---
schema_version: "1"
id: b768510693ac59e4e19113db5c950b5acec74fa4673e7b819822507d81cdc671
title: Batch Job (<batch:job/>)
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/anypoint-code-builder/acb-component-batch.md
canonical_url: https://docs.mulesoft.com/anypoint-code-builder/acb-component-batch
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 9d5a1af40563f6d43ff345786cf2ba67dab041e44be825014f6ec5c33b9839db
description: MuleSoft Documentation Site
latest: true
---
---
product: Anypoint Code Builder
version: master
---

# Batch Job (<batch:job/>)

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

Defines the main batch processing scope. A batch job contains two phases:

- **Process Records**: Executes the record processing logic defined in nus.

- **On Complete**: Executes after all records are processed, for example to log results or perform
  cleanup.

## Configuration Options

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Property</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><p><code>doc:name</code></p></td><td><p>String</p></td><td><p>Auto-generated</p></td><td><p>Display name for the component in the canvas</p></td></tr><tr><td><p><code>doc:id</code></p></td><td><p>String</p></td><td><p>Auto-generated</p></td><td><p>Unique identifier for the component</p></td></tr><tr><td><p><code>batchBlockSize</code></p></td><td><p>Integer</p></td><td><p>50</p></td><td><p>Number of records per block to process concurrently within the Process Records phase</p></td></tr></tbody></table>

## Child Elements and Scopes

- One or more [Batch Steps](#batch-step) inside the job

- One optional **On Complete** scope

## Batch Processing Constraints

- Batch jobs can’t be nested.

- At least one [Batch Step](#batch-step) must be present.

## Batch Processing Example

<batch:job doc:name="Batch Job Example" doc:id="job-1" batchBlockSize="100"> <batch:step
doc:name="Step 1" doc:id="step-1"> <!-- record processors --> </batch:step> <batch:on-complete
doc:name="On Complete" doc:id="onComplete-1"> <!-- final operations --> </batch:on-complete>
</batch:job>

## Batch Step (batch:step/)

Defines a step inside a batch job. Steps group record-level processors and can optionally include a
batch aggregator.

### Batch Processing Configuration Options

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Property</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><p>doc:name</p></td><td><p>String</p></td><td><p>Auto-generated</p></td><td><p>Display name in the canvas</p></td></tr><tr><td><p>doc:id</p></td><td><p>String</p></td><td><p>Auto-generated</p></td><td><p>Unique identifier for the component</p></td></tr></tbody></table>

## Child Elements and Sub-Scopes

**Processors**: A sequence of processors (for example, **Transform**, **Logger**) that act on each
record.

**Batch Aggregator**: Aggregates records into blocks (optional).

## Batch Aggregator Constraints

Only one Batch Aggregator is allowed per step.

## Batch Aggregator (batch:aggregator/)

Aggregates records into blocks within a [Batch Step](#batch-step) for grouped processing before
records are sent back into the flow.

## Batch Aggregator Configuration Options

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Property</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><p>doc:name</p></td><td><p>String</p></td><td><p>Auto-generated</p></td><td><p>Display name in the UI</p></td></tr><tr><td><p>doc:id</p></td><td><p>String</p></td><td><p>Auto-generated</p></td><td><p>Unique identifier for the component</p></td></tr><tr><td><p>aggregatorSize</p></td><td><p>Integer</p></td><td><p>100</p></td><td><p>Number of records to group before applying aggregation logic</p></td></tr></tbody></table>

## Batch Step Behavior

Groups incoming records into blocks of the specified size.

After processing, the records are sent back to the Process Records phase of the Batch Job.

## See Also

[Core Components Reference](https://docs.mulesoft.com/anypoint-code-builder/ref-components)

[Debugging Mule Applications](https://docs.mulesoft.com/anypoint-code-builder/int-debug-mule-apps)
