# How do enterprise architects evaluate and choose between Future, Queueable, Batch, and Scheduled Apex for complex integration workflows?

**Topic:** Apex · **Difficulty:** Medium · **Tags:** Apex, Asynchronous Apex, Architecture

Read it on the site: https://www.forcechallenges.com/interview-questions/how-do-enterprise-architects-evaluate-and-choose-between-future-queueable-batch-and-scheduled-apex-for

## Answer

**Basics:** All four run outside the user's transaction with higher limits. They differ in volume handling, parameters, monitoring and chaining.

**How it works / decision guide:**
- Future (`@future`): static, void, primitive or collection-of-primitive parameters, up to 50 per transaction, no Id returned, cannot be called from batch or future. Legacy; mostly replaced by Queueable.
- Queueable: object parameters (sObjects, custom types), returns a job Id, can chain one child from a running job, supports Finalizers and `AsyncOptions`; 50 enqueues per sync transaction.
- Batch: millions of records (QueryLocator up to 50 million), scope 1 to 2000, 5 concurrent plus 100 in the Flex Queue, Stateful option.
- Scheduled: cron-driven (max 100 jobs), runs as a thin launcher.

**Advanced / deep dive:** For integrations: event-driven outbound calls fit a trigger enqueuing a Queueable with `Database.AllowsCallouts` and a Finalizer for retry; high-volume sync fits Scheduled launching Batch with `Database.AllowsCallouts` and a callout-safe scope; near real-time fan-out fits platform events or Change Data Capture rather than polling. Consider the daily async execution limit (greater of 250,000 or licenses x 200), callout limits (100 per transaction, 120 s cumulative), idempotency, retries with backoff, and observability (log object plus `BatchApexErrorEvent`). Also evaluate declarative options (Flow scheduled paths, async paths, Orchestrator) and newer Apex Cursors for large paging (verify release availability).

**Code / config example:**
```apex
// Scheduled dispatcher launches the right async tool
public class IntegrationDispatcher implements Schedulable {
    public void execute(SchedulableContext sc) {
        Database.executeBatch(new OutboundSyncBatch(), 50); // batch implements Database.AllowsCallouts
    }
}
```

**Hidden gotchas & must-remember points:**
- `@future` parameters must be primitives or collections of primitives, never sObjects.
- Only 1 child queueable from a running queueable; production chain depth is unlimited, 5 in Developer Edition.
- Batch and Queueable can both exhaust the daily async limit when running per record.
- Callouts from Batch need `Database.AllowsCallouts`.
- Order of execution between async jobs is not guaranteed.
- Scheduled `execute()` has sync limits.

**Best practice:** Default to Queueable for single tasks, Batch for volume, Scheduled as a launcher, and design every job to be idempotent and observable.

---
Source: ForceChallenges · last updated 2026-11-02
