BookatlasTwo-Day MuleSoft → Salesforce Bootcamp

Module 11 — Salesforce Bulk Processing + Mule Batch Jobs

AllInterview Q&A 76Cheat sheets 17Code 278

This module is about what changes when the requirement is no longer:

“process 1 customer”

but:

“process 100,000 customers”

At that point, a normal synchronous flow with a For Each and one Salesforce call per record is usually the wrong design.

The two concepts to separate are:

Salesforce Bulk API
vs
Mule Batch Job

They solve related but different problems.

11.1The simplest mental modelThink:32 words11.2Why normal CRUD stops scalingSuppose:14 words11.3Salesforce Bulk APIThe Salesforce Connector exposes Bulk API functionality, including current Bulk API v2 operations for insert, update, upsert, delete, and…36 words11.4Bulk API v2 write exampleRequirement:25 words11.5Why Bulk API is asynchronousIf Salesforce had to synchronously return after processing:33 words11.6Job lifecycleConceptually:18 words11.7Bulk queryBulk isn't only for writes.38 words11.8codeBulk query scenarioExample:19 words11.9Pagination and memoryCurrent MuleSoft documentation notes that Bulk API v2 query-result retrieval supports paging and that page size affects both API call count…52 words11.10StreamingWith large data, the word:41 words11.11Repeatable vs non-repeatable streamsHigh-level only:50 words11.12Mule Batch JobNow let's switch from Salesforce to Mule.29 words11.13Batch Job internalsImagine input:44 words11.14Batch StepA Batch Step defines processing applied to records.19 words11.15Record-level processingInside a Batch Step:43 words11.16Batch failures don't necessarily stop everythingThis is one of the best features.37 words11.17`maxFailedRecords`Mule Batch lets you define how many record failures are acceptable before stopping the job.39 words11.18Why this mattersImagine source file:20 words11.19Batch Step accept policiesSuppose Step 1 validates.49 words11.20Example batch pipelineLet's design:15 words11.21Batch AggregatorThis one matters a lot.44 words11.22Why Aggregator is importantBad:18 words11.23Aggregator fixed sizeConceptually:20 words11.24Aggregator streaming modeA Batch Aggregator can also operate in streaming mode instead of waiting for a fixed-size block.44 words11.25Mule Batch vs Salesforce Bulk API againLet's make the distinction crystal clear.21 words11.26You don't always need bothCase:26 words11.27Normal Connector vs Bulk APIA useful interview heuristic:59 words11.28Batch size tuningIf you aggregate:28 words11.29Failure granularity tradeoffImagine batch size:28 words11.30codeSalesforce partial failuresSuppose a bulk upsert contains:21 words11.31Separate transient vs permanent bulk errorsSame rule as Module 7.23 words11.32Don't replay successful records unnecessarilySuppose:11 words11.33External IDs are even more valuable in bulkImagine bulk job times out from Mule's perspective.36 words11.34Parent-child bulk loadSuppose you need:29 words11.35Don't assume all entities can load in parallelExample:19 words11.36Large synchronization designRequirement:38 words11.37Full reload vs delta loadSimple.19 words11.38Deletes are the awkward partSuppose source record disappears.21 words11.39ReconciliationEven a beautifully designed delta sync can drift.20 words11.40codeOn CompleteMule Batch has an On Complete phase after record processing finishes.29 words11.41Don't use On Complete for every recordOn Complete is job-level reporting.32 words11.42Batch Jobs are asynchronousAn important behavioral point:36 words11.43Batch restartabilityOne reason Mule Batch is attractive is reliability.49 words11.44Parallelism inside Mule BatchBatch steps can process record blocks in parallel.22 words11.45Salesforce record locking at scaleExample:35 words11.46Serial vs parallelHigh level:34 words11.47Don't put an HTTP call inside each Batch record casuallyImagine:15 words11.48N+1 at bulk scale is catastrophicWith normal API work:18 words11.49Memory is an architectural constraintSuppose each customer record averages:24 words11.50Q&AInterview scenarioWe have 500,000 records to load into Salesforce overnight. How would you build it?103 words11.51Q&AInterview scenarioWhy not Parallel For Each?51 words11.52Q&AInterview scenarioOne record in 100,000 is invalid. What happens?69 words11.53Q&AInterview scenario15% of the job suddenly fails with INVALID_FIELD.33 words11.54Error-rate thresholdsThis is an excellent production idea.20 words11.55Testing bulk integrationsYou should test more than happy-path count.20 words11.56Test mixed outcomesDataset:2 words11.57Test restart/replaySimulate:10 words11.58Test relationship orderingExample:7 words11.59Test reconciliationAfter job:13 words11.60Batch performance metricsMeasure:10 words11.61Your production dashboardFor a nightly sync, I would want something like:17 words11.62Q&AMule Batch vs Salesforce Bulk interview summaryIf asked:76 wordscheat sheetModule 11 Cheat SheetThe interview sentence to memorize is:110 words