Batch Processing Deep Dive β Interview Questions & Scenarios (2026)
Input, Process, and On Complete phases, Batch Aggregator sizing, maxFailedRecords, and commit rollbacks.
π Batch Processing Deep Dive
Input, Process, and On Complete phases, Batch Aggregator sizing, maxFailedRecords, and commit rollbacks.
What is a Batch Job? What are its phases?
Batch Job processes large datasets by splitting them into records and processing them individually
with fault tolerance β individual record failures don't stop the whole job.
π BATCH JOB PHASES
Mule 4 3 Phases (no separate XML Input phase as in Mule 3):
1. Load & Dispatch: Implicit phase that splits the payload into individual records and queues them persistently before stepping.
Process (Batch Steps): Each record passes through sequential Batch Steps. Each step can have accept
expressions to filter which records enter that step.
On Complete: Runs after all records are processed. Has access to batchJobResult β summary of
processed/failed/successful counts. Used for notifications, cleanup, watermark updates.
Batch Job Structure
Project: Commercial Banking β Nightly Account & Ledger Reconciliation.
Problem: Synchronous iteration over 85,000 nightly delta records frequently ran out of heap memory and failed completely if record #40,000 threw an exception.
What I Did: Implemented a Mule 4 Batch Job with maxFailedRecords=-1, routing records into batch steps with a Batch Aggregator of 250 records for bulk upserting to Finacle Core Banking, SWIFT Network, Kafka Event Broker.
Result: Cut nightly execution time from 2.5 hours to 34 minutes with zero OOM errors and automated error reporting in On Complete.
What is Batch Aggregator and when do you use it?
Batch Aggregator groups individual records back into a collection of a specified size before
processing. Used in the last Batch Step to do bulk database inserts or Salesforce Upsert Bulk
operations.
Example: 50,000 records β Batch Job processes each individually β Batch Aggregator(size=500) β
groups into 100 batches of 500 β each batch does one bulk Salesforce Upsert call β 100 calls instead
of 50,000. 500x efficiency.
Project: Telecommunications β Nightly Account & Ledger Reconciliation.
Problem: Synchronous iteration over 85,000 nightly delta records frequently ran out of heap memory and failed completely if record #40,000 threw an exception.
What I Did: Implemented a Mule 4 Batch Job with maxFailedRecords=-1, routing records into batch steps with a Batch Aggregator of 250 records for bulk upserting to Amdocs CRM, Ericsson HLR, Matrixx Engine.
Result: Cut nightly execution time from 2.5 hours to 34 minutes with zero OOM errors and automated error reporting in On Complete.
What is maxFailedRecords in Batch Job? What is the default?
maxFailedRecords controls when Batch Job stops processing due to too many failures. Default is 0
β any single record failure stops the entire job.
VALUE BEHAVIOR
0 (default) Job stops on first failure
N Job continues until N records fail, then stops
-1 Job never stops β processes all records regardless of failures
In our Enterprise Architecture: we use maxFailedRecords=1000 for the nightly SAP account sync β allows 1000 individual
record failures before the job stops, ensuring bulk data loads complete even with occasional bad
records.
π¬ CROSS-QUESTIONS INTERVIEWERS ASK ABOUT THIS TOPIC
"What is the DEFAULT value of maxFailedRecords β 0 or -1?" β 0 β the batch job stops on the very
first record failure. Many candidates assume -1 (unlimited); 0 is the actual default and a common interview
trap.
"If maxFailedRecords=0 and record #500 fails out of 10,000 records, what happens to records 501β
10,000?" β They are NOT processed. The batch job immediately stops and moves to the On Complete
phase, leaving the remaining records unprocessed.
"What does maxFailedRecords=-1 mean?" β Never stop β the job processes all records regardless of
how many fail. Useful for bulk loads where partial completion is acceptable.
"If the Mule app crashes at record 30,000 of 100,000, does the batch job resume from 30,001?" β
YES β if a persistent watermark is configured, the batch job can resume from where it stopped. Without a
watermark, it restarts from the beginning.
Project: Healthcare β Nightly Account & Ledger Reconciliation.
Problem: Synchronous iteration over 85,000 nightly delta records frequently ran out of heap memory and failed completely if record #40,000 threw an exception.
What I Did: Implemented a Mule 4 Batch Job with maxFailedRecords=-1, routing records into batch steps with a Batch Aggregator of 250 records for bulk upserting to Epic Systems, Cerner HL7/FHIR, AWS S3 HIPAA Vault.
Result: Cut nightly execution time from 2.5 hours to 34 minutes with zero OOM errors and automated error reporting in On Complete.
What happens in the On Complete phase? What data is available?
On Complete runs after all records have been processed (success or failure). The payload in On
Complete is a BatchJobResult object with:
payload.batchJobId β unique ID of this batch run
payload.successfulRecords β count of successfully processed records
payload.failedRecords β count of failed records
payload.totalRecords β total input records
payload.loadedRecords β records loaded in Load & Dispatch phase
In our Enterprise Architecture: On Complete sends a summary email via Email Connector, updates ObjectStore watermark
with the latest timestamp, and publishes failed record IDs to a DLQ for manual review.
How do you roll back records in batch processing?
Batch processing does NOT have automatic XA-style rollback. For rollback patterns:
Database transactions: Use a Try scope within a Batch Step with XA transaction if all records must
succeed together β but this is expensive and slow at scale.
Compensation pattern: In On Complete, check failedRecords > 0 β trigger a compensation
flow that deletes/reverses the successfully inserted records based on a tracking field.
Two-phase approach: First batch step writes to a staging table. Second batch step (accept only
successful records) moves to production table. On Complete: delete staging table if any failures.
Project: Insurance β Nightly Account & Ledger Reconciliation.
Problem: Synchronous iteration over 85,000 nightly delta records frequently ran out of heap memory and failed completely if record #40,000 threw an exception.
What I Did: Implemented a Mule 4 Batch Job with maxFailedRecords=-1, routing records into batch steps with a Batch Aggregator of 250 records for bulk upserting to Guidewire ClaimCenter, Salesforce Financial Services Cloud.
Result: Cut nightly execution time from 2.5 hours to 34 minutes with zero OOM errors and automated error reporting in On Complete.