Salesforce Decode
Salesforcedecode
Back to questions
ApexIntermediateasyncqueueablebatchscheduled

Choose between Queueable, Batch, and Scheduled Apex for async processing

Real World Scenario

Nightly job must recalculate territory assignments for 2M Accounts, call external geocoding API, and send summary email to admins.

Expected Answer

• Batch Apex for large volume chunked processing with start/execute/finish pattern • Queueable for smaller async chains needing callout from trigger with job chaining • Scheduled Apex to kick off batch at off-peak window • Callouts require implements Database.AllowsCallouts on batch/queueable as appropriate • Governor limits differ: batch gets fresh limits per execute chunk • Monitor AsyncApexJob for failures and implement retry in finish method • Avoid long synchronous callout chains in triggers—always async

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Main difference: use case and scale. Batch Apex for large volume chunked processing with start/execute/finish pattern. Queueable for smaller async chains needing callout from trigger with job chaining. Pick based on your integration pattern and team capability. Async pattern selection is capacity planning—architects document decision matrix by volume and latency requirements. Balance speed of delivery with maintainability.

Architect Perspective

Async pattern selection is capacity planning—architects document decision matrix by volume and latency requirements.