Step 7 of 21
·
4 minutes
Batch Processing
The Scenario
At month-end, we need to generate individual statements for 10,000 cardholders.
Only after ALL statements are ready should we create the summary report.
If any statement fails, we shouldn't create a partial summary.
The Challenge
How do we coordinate thousands of jobs and trigger a follow-up action only when they ALL succeed?
The Solution
Use JobRunr's
Batch feature with
continueWith():
jobScheduler
.startBatch(this::generateAllStatements)
.continueWith(this::createSummaryReport);
All child jobs start in
AWAITING state. The child jobs start processing only after all of them are created.
If the parent fails to create the child jobs, all children are rolled back atomically.
The continuation only runs when ALL children succeed.
Read the documentation →
Try It Yourself
Trigger the monthly statement generation recurring job on the Dashboard. Watch the batch create all individual
jobs, and then observe the summary job execute only after all succeed.
You need to log in to perform write operations. You can still view the code solution and dashboard.