Continuations for long-running asynchronous callouts
When and how to use the Apex Continuation class from LWC, Aura and Visualforce: background actions that don't block others, up to three parallel or chained callouts, the 120-second continuation timeout, no DML before the callback, and the 80 KB Visualforce controller-state limit.
Analyze a scenario and determine performance improvements that can be achieved with an asynchronous callout.
~7 min read · 8 practice questions ·
What the exam expects
- Explain the performance benefit of a continuation over a synchronous callout from a Lightning component or Visualforce page, using current (post-Winter '20) limit rules.
- Choose parallel callouts in one continuation versus chained continuations from whether the requests depend on each other.
- Wire a continuation correctly:
@AuraEnabled(continuation=true), the@salesforce/apexContinuationimport, the callback andcacheablerules. - Diagnose failures: DML before the callout, status code 2000 timeouts, ignored
HttpRequesttimeouts and Visualforce controller-state overflow.
Key terms: continuation (an asynchronous callout from a Visualforce page or Lightning component whose response returns through a callback), callback method (the method named by continuationMethod that processes the responses), boxcar'ing (the framework batching several actions into one request), request label (the string addHttpRequest() returns to identify a request), controller state (the serialized Visualforce controllers a continuation carries).
Key facts
- Detail
- 3
- Detail
- 3
- Detail
- Maximum 120 seconds;
HttpRequesttimeouts ignored
- Detail
- 80 KB, separate from 170 KB view state
- Detail
- 1 MB maximum
- Detail
- Timeout reached before the server responded
- Detail
- New transaction; all limits reset
- Detail
- All callouts excluded since Winter '20
- Detail
@salesforce/apexContinuation/Class.method
- Detail
- One continuation in progress at a time
- Detail
- Not in the method returning the Continuation; allowed in the callback
Sources for this section (5)
- Asynchronous Callout Limitsdeveloper.salesforce.com (opens in a new tab)
- Continuation Classdeveloper.salesforce.com (opens in a new tab)
- Make Long-Running Callouts with Continuations (LWC)developer.salesforce.com (opens in a new tab)
- Continuation Example (LWC)developer.salesforce.com (opens in a new tab)
- Continuation Limits (LWC)developer.salesforce.com (opens in a new tab)
- Why do continuations still help after Winter '20 if all callouts are excluded from the long-running request limit?
- When should you chain continuations instead of adding requests to one continuation?
- What does status code 2000 from `Continuation.getResponse()` mean?
- Why can a Visualforce continuation fail on state size even when view state is under 170 KB?
- Which two declarations does an LWC continuation need?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the Platform Developer II pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 28 lessons of the Platform Developer II guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Inline practice questions and one-click topic practice (8 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams