{"id":2488,"date":"2026-10-31T13:00:00","date_gmt":"2026-10-31T07:30:00","guid":{"rendered":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/"},"modified":"2026-11-15T22:00:16","modified_gmt":"2026-11-15T16:30:16","slug":"apex-continuation-callouts","status":"publish","type":"post","link":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/","title":{"rendered":"Apex Continuation for Long Running Callouts Explained"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Apex Continuation lets a component call a slow web service and get the answer back without holding a Salesforce worker thread while it waits. The request goes out, the thread is released, and a second method runs when the response arrives.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This exists for one reason. A normal Apex callout blocks until the service answers, and the platform counts that waiting time against your transaction. A service taking 50 seconds is a problem no amount of tuning on your side can fix.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-diagram-1-1024x640.png\" alt=\"Apex Continuation diagram showing handoff, release and callback\" class=\"wp-image-2486\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-diagram-1-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-diagram-1-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-diagram-1-768x480.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Caption: The user keeps waiting on screen, but Salesforce is not holding a thread while that happens.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Is Apex Continuation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Apex Continuation is a pattern for asynchronous callouts from an AuraEnabled method. You write two methods instead of one. The first starts the callout and returns a <code>Continuation<\/code> object. The second receives the response.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public with sharing class QuoteService {\n\n    @AuraEnabled(continuation=true cacheable=false)\n    public static Object getQuote(String courseId) {\n        Continuation con = new Continuation(60);\n        con.continuationMethod = 'handleResponse';\n        con.state = courseId;\n\n        HttpRequest req = new HttpRequest();\n        req.setEndpoint('callout:Partner_Quotes\/quote?course=' + courseId);\n        req.setMethod('GET');\n        con.addHttpRequest(req);\n\n        return con;\n    }\n\n    @AuraEnabled\n    public static String handleResponse(List&lt;String&gt; labels, Object state) {\n        HttpResponse res = Continuation.getResponse(labels[0]);\n        if (res.getStatusCode() != 200) {\n            throw new AuraHandledException('The quote service is unavailable');\n        }\n        return res.getBody();\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Three details carry the whole Apex Continuation pattern. The first method returns the <code>Continuation<\/code> rather than a value. The <code>continuationMethod<\/code> names the second method as a string. And <code>state<\/code> is how you pass context from the first method to the second, since they are separate transactions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The Labels Argument<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Apex Continuation gives you a label from each <code>addHttpRequest<\/code> call. The callback receives those labels in order, and you use each one to fetch its response.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>String feeLabel = con.addHttpRequest(feeReq);\nString seatLabel = con.addHttpRequest(seatReq);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Both requests go out together. The callback runs once, after every response has arrived, which is how you make three slow calls cost one wait rather than three.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Apex Continuation Matters<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Benefit<\/th><th>What it gives you<\/th><\/tr><\/thead><tbody><tr><td>No held thread<\/td><td>Org wide concurrency stays healthy<\/td><\/tr><tr><td>Longer waits allowed<\/td><td>Up to two minutes of service time<\/td><\/tr><tr><td>Parallel callouts<\/td><td>Three requests in one wait<\/td><\/tr><tr><td>A live screen<\/td><td>The user gets the real answer, not a promise<\/td><\/tr><tr><td>Normal error handling<\/td><td>Exceptions still reach the component<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The concurrency point is the one that matters at scale. An org has a limit on long running synchronous requests, and a handful of slow callouts can use them all up, which slows every other user. The post on <a href=\"https:\/\/swapnilzambare.com\/blog\/apex-governor-limits-explained\/\">governor limits<\/a> lists what those limits cover.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Calling It from a Component<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">From the component side an Apex Continuation looks like any other call. The method is called like any other imperative Apex call.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import getQuote from '@salesforce\/apex\/QuoteService.getQuote';\n\nasync handleClick() {\n  this.loading = true;\n  try {\n    this.quote = await getQuote({ courseId: this.recordId });\n  } catch (e) {\n    this.error = e.body ? e.body.message : 'Could not load the quote';\n  } finally {\n    this.loading = false;\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The promise resolves with whatever the callback method returned. That is the quiet strength of the pattern, because the component never needs to know a continuation was involved. The post on <a href=\"https:\/\/swapnilzambare.com\/blog\/call-apex-from-lwc-wire-imperative\/\">calling Apex<\/a> covers the call styles themselves.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A spinner is not optional here. The user may wait thirty seconds, so show progress and keep the button disabled while the call is in flight.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Chaining a Second Callout<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">An Apex Continuation callback can itself return another continuation, which is how a two step conversation with a service works.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@AuraEnabled\npublic static Object handleFirst(List&lt;String&gt; labels, Object state) {\n    HttpResponse res = Continuation.getResponse(labels[0]);\n    String token = parseToken(res.getBody());\n\n    Continuation next = new Continuation(60);\n    next.continuationMethod = 'handleSecond';\n    HttpRequest req = new HttpRequest();\n    req.setEndpoint('callout:Partner_Quotes\/detail?token=' + token);\n    req.setMethod('GET');\n    next.addHttpRequest(req);\n    return next;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">There is a chain depth limit of three, so a four step conversation needs a different design. In practice, a service needing four round trips should expose one endpoint that does the work.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Apex Continuation vs a Queueable Callout<\/h2>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-diagram-2-1024x640.png\" alt=\"Apex Continuation and queueable callout comparison diagram\" class=\"wp-image-2487\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-diagram-2-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-diagram-2-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-diagram-2-768x480.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Caption: The question is whether a user is waiting for the answer right now.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Situation<\/th><th>Pick<\/th><\/tr><\/thead><tbody><tr><td>A price quote the user is staring at<\/td><td>Continuation<\/td><\/tr><tr><td>Three slow lookups for one screen<\/td><td>Continuation<\/td><\/tr><tr><td>A nightly sync of 10,000 records<\/td><td>Queueable<\/td><\/tr><tr><td>A callout after a record saves<\/td><td>Queueable<\/td><\/tr><tr><td>Work that should retry tomorrow<\/td><td>Queueable<\/td><\/tr><tr><td>A conversation of two or three steps during a click<\/td><td>Continuation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The deciding question is simple. Is someone watching the screen for this specific answer? If yes, Apex Continuation. If the work can finish later and write a record, a queueable is simpler and gives you retries. The post on <a href=\"https:\/\/swapnilzambare.com\/blog\/queueable-apex-chaining-finalizers\/\">queueable jobs<\/a> covers that route.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A Real Apex Continuation Example<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Apex Continuation fixed a slow screen for us. Bright Path Tutors shows a live fee quote from a partner finance service on the enrolment screen. That service takes between 8 and 40 seconds depending on the day.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first build used a plain synchronous callout.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Problem<\/th><th>What happened<\/th><\/tr><\/thead><tbody><tr><td>Thread held for 40 seconds<\/td><td>Other users saw slow page loads<\/td><\/tr><tr><td>Long running request limit hit<\/td><td>Six concurrent quotes blocked the org<\/td><\/tr><tr><td>Three lookups in sequence<\/td><td>Up to two minutes of waiting<\/td><\/tr><tr><td>No clear failure message<\/td><td>Users clicked again and made it worse<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We rebuilt it with one continuation holding three parallel requests.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Measure<\/th><th>Synchronous<\/th><th>Continuation<\/th><\/tr><\/thead><tbody><tr><td>Threads held during the wait<\/td><td>1 per user<\/td><td>0<\/td><\/tr><tr><td>Worst case wait<\/td><td>120 seconds<\/td><td>42 seconds<\/td><\/tr><tr><td>Concurrency incidents a month<\/td><td>4<\/td><td>0<\/td><\/tr><tr><td>Requests per screen load<\/td><td>3 in sequence<\/td><td>3 in parallel<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The parallel requests halved the wait on their own. The concurrency fix is what stopped the support tickets from other teams.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Limits and Things to Watch<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Three callouts in one continuation, and a chain depth of three<\/li>\n\n<li>A timeout ceiling of 120 seconds per continuation<\/li>\n\n<li>Only from an AuraEnabled method, so Flows and triggers cannot use it<\/li>\n\n<li>The callback is a separate transaction, so instance state is gone<\/li>\n\n<li>Request and response size limits apply, so very large payloads fail<\/li>\n\n<li>No automatic retry, since the user is waiting and would see the delay<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The separate transaction in an Apex Continuation causes the most confusion. Anything the first method knew has to travel in <code>state<\/code>, which is serialized. A class member variable set in the first method is simply not there in the callback.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Testing an Apex Continuation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Apex Continuation tests use dedicated helpers and a slightly different setup.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@IsTest\nprivate class QuoteServiceTest {\n    @IsTest\n    static void returnsQuote() {\n        Continuation con = (Continuation) QuoteService.getQuote('a01xx');\n        HttpResponse res = new HttpResponse();\n        res.setStatusCode(200);\n        res.setBody('{\"fee\":4500}');\n\n        Test.setContinuationResponse(con.getRequests().keySet().iterator().next(), res);\n        Object result = Test.invokeContinuationMethod(new QuoteService(), con);\n        System.assertEquals('{\"fee\":4500}', (String) result);\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Two helpers do the work. <code>Test.setContinuationResponse<\/code> supplies a fake response per label, and <code>Test.invokeContinuationMethod<\/code> runs the callback. The post on <a href=\"https:\/\/swapnilzambare.com\/blog\/apex-callout-mocks-httpcalloutmock\/\">callout mocks<\/a> covers mocking ordinary callouts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes with Apex Continuation<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Mistake<\/th><th>What you see<\/th><th>Fix<\/th><\/tr><\/thead><tbody><tr><td>Returning a value instead of the object<\/td><td>The callout never happens<\/td><td>Return the Continuation from the first method<\/td><\/tr><tr><td>State kept in a class field<\/td><td>Null in the callback<\/td><td>Pass it through the state property<\/td><\/tr><tr><td>Callback name misspelled<\/td><td>A runtime error on the call<\/td><td>Match the method name exactly<\/td><\/tr><tr><td>No spinner in the component<\/td><td>Users click twice<\/td><td>Disable the button and show progress<\/td><\/tr><tr><td>Sequential continuations for parallel work<\/td><td>Three waits instead of one<\/td><td>Add all requests to one continuation<\/td><\/tr><tr><td>Using it from a trigger<\/td><td>It will not compile that way<\/td><td>Use a queueable for trigger driven callouts<\/td><\/tr><tr><td>No error path<\/td><td>A silent empty panel<\/td><td>Throw AuraHandledException and catch it<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for Apex Continuation<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add every independent request to one continuation so they run in parallel<\/li>\n\n<li>Put all context in the state property, never in a class field<\/li>\n\n<li>Set a timeout you have actually measured, not the maximum by default<\/li>\n\n<li>Throw an AuraHandledException so the message reaches the user<\/li>\n\n<li>Show a spinner and disable the trigger button while the call is in flight<\/li>\n\n<li>Use a named credential so the endpoint and token stay out of code<\/li>\n\n<li>Reach for a queueable whenever nobody is waiting on the answer<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Most Asked Apex Continuation Interview Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q1: What problem does a continuation solve?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It lets a component wait on a slow web service without Salesforce holding a worker thread.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q2: How many methods does the pattern need?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two. One starts the callout and returns the object, and one handles the response.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q3: What does the first method return?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Continuation object itself, not a value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q4: How is the callback named?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As a string on the continuationMethod property.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q5: How does context travel between the two methods?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Through the state property, since the callback runs in a separate transaction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q6: Why can you not use a class field for that?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The callback is a new transaction, so instance state from the first method is gone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q7: What are the labels in the callback for?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each label identifies one request, and you use it to fetch that response.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q8: How many callouts can one continuation hold?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Three, and they run in parallel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q9: What is the chain depth limit?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Three, so a callback can return another continuation up to that depth.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q10: What is the maximum timeout?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">120 seconds for a continuation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q11: Can a trigger use one?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">No. It works only from an AuraEnabled method.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q12: Can a Flow use one?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">No. Flow needs an invocable method, so a queueable is the usual route there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q13: Does the user wait during the call?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. The screen stays live, which is why a spinner is essential.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q14: What is the difference from a queueable callout?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A queueable runs later and writes a result somewhere, while a continuation returns to the waiting component.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q15: When would you pick a queueable instead?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Whenever nobody is watching for the answer right now, or when you want retries.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q16: How do you make three slow calls cost one wait?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add all three requests to the same continuation so they run in parallel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q17: How do you surface an error to the component?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Throw an AuraHandledException in the callback and catch it in the component.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q18: Is there automatic retry?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">No, because a user is waiting and a retry would extend the delay.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q19: How do you test one?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With Test.setContinuationResponse per label and Test.invokeContinuationMethod to run the callback.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q20: Scenario: the callout seems to never happen. What is the first thing to check?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Whether the first method returns the Continuation object rather than a value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q21: Scenario: the callback throws a null reference on a field you set earlier. Why?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That field belonged to the first transaction. Move the value into state.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q22: Scenario: three lookups take two minutes. How do you fix it?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Put all three requests in one continuation instead of chaining them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q23: Scenario: users double click and create two quotes. What is missing?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A disabled button and a spinner while the call is in flight.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q24: Does a continuation count against callout limits?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, the callouts themselves count, though the waiting time is not held in your transaction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q25: Can you use a named credential with it?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, with the callout prefix on the endpoint, which is the right way to do it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q26: Why is thread concurrency the real argument for this?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An org limits long running synchronous requests, and slow callouts can exhaust them for everyone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q27: What happens if the service exceeds the timeout?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The response is not available, so handle that case and show a clear message.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q28: Is this pattern common in new builds?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Less so, since many teams move slow work to a queueable and notify the screen instead.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q29: What is the one habit that keeps it reliable?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Everything in state, all requests in one continuation, and an honest error message.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.apexcode.meta\/apexcode\/\" target=\"_blank\" rel=\"noopener noreferrer\">Apex Developer Guide<\/a><\/li>\n\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/platform\/lwc\/guide\/\" target=\"_blank\" rel=\"noopener noreferrer\">Lightning Web Components Developer Guide<\/a><\/li>\n\n<li><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/asynchronous_apex\" target=\"_blank\" rel=\"noopener noreferrer\">Asynchronous Apex on Trailhead<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What Is Next<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, read <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-connect-custom-adapters\/\">Salesforce Connect Custom Adapters Built in Apex<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apex Continuation lets a component call a slow web service and get the answer back without holding a Salesforce worker thread while it waits.&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2485,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[246,8,96],"tags":[68,98,81],"swapz_series":[],"class_list":["post-2488","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-integration-apis","category-salesforce","category-salesforce-developer","tag-advanced","tag-apex","tag-integration"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Apex Continuation for Long Running Callouts<\/title>\n<meta name=\"description\" content=\"Apex Continuation lets a component wait on a slow web service without holding a thread. Learn the two method pattern, the limits and the alternatives.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Apex Continuation for Long Running Callouts\" \/>\n<meta property=\"og:description\" content=\"Apex Continuation lets a component wait on a slow web service without holding a thread. Learn the two method pattern, the limits and the alternatives.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/\" \/>\n<meta property=\"og:site_name\" content=\"Swapnil Zambare - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-31T07:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-15T16:30:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Swapnil Zambare\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Swapnil Zambare\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/\"},\"author\":{\"name\":\"Swapnil Zambare\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/10b09224c8bcc562716e86789427592a\"},\"headline\":\"Apex Continuation for Long Running Callouts Explained\",\"datePublished\":\"2026-10-31T07:30:00+00:00\",\"dateModified\":\"2026-11-15T16:30:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/\"},\"wordCount\":1750,\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/apex-continuation-callouts-featured.png\",\"keywords\":[\"Advanced\",\"Apex\",\"Integration\"],\"articleSection\":[\"Integration and APIs\",\"Salesforce\",\"Salesforce Developer\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/\",\"name\":\"Apex Continuation for Long Running Callouts\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/apex-continuation-callouts-featured.png\",\"datePublished\":\"2026-10-31T07:30:00+00:00\",\"dateModified\":\"2026-11-15T16:30:16+00:00\",\"description\":\"Apex Continuation lets a component wait on a slow web service without holding a thread. Learn the two method pattern, the limits and the alternatives.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/#primaryimage\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/apex-continuation-callouts-featured.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/apex-continuation-callouts-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Apex Continuation featured image showing a request handed off while the thread is released\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/apex-continuation-callouts\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Apex Continuation for Long Running Callouts Explained\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"name\":\"Swapnil Zambare - Blog\",\"description\":\"Salesforce &amp; Tech Guides\",\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\",\"name\":\"Swapnil Zambare - Blog\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"width\":512,\"height\":512,\"caption\":\"Swapnil Zambare - Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/theSwapnilZambare\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/10b09224c8bcc562716e86789427592a\",\"name\":\"Swapnil Zambare\",\"sameAs\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\"],\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/author\\\/swapnil-zambare\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Apex Continuation for Long Running Callouts","description":"Apex Continuation lets a component wait on a slow web service without holding a thread. Learn the two method pattern, the limits and the alternatives.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/","og_locale":"en_US","og_type":"article","og_title":"Apex Continuation for Long Running Callouts","og_description":"Apex Continuation lets a component wait on a slow web service without holding a thread. Learn the two method pattern, the limits and the alternatives.","og_url":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/","og_site_name":"Swapnil Zambare - Blog","article_published_time":"2026-10-31T07:30:00+00:00","article_modified_time":"2026-11-15T16:30:16+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-featured.png","type":"image\/png"}],"author":"Swapnil Zambare","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Swapnil Zambare","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/#article","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/"},"author":{"name":"Swapnil Zambare","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/10b09224c8bcc562716e86789427592a"},"headline":"Apex Continuation for Long Running Callouts Explained","datePublished":"2026-10-31T07:30:00+00:00","dateModified":"2026-11-15T16:30:16+00:00","mainEntityOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/"},"wordCount":1750,"publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-featured.png","keywords":["Advanced","Apex","Integration"],"articleSection":["Integration and APIs","Salesforce","Salesforce Developer"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/","url":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/","name":"Apex Continuation for Long Running Callouts","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/#primaryimage"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-featured.png","datePublished":"2026-10-31T07:30:00+00:00","dateModified":"2026-11-15T16:30:16+00:00","description":"Apex Continuation lets a component wait on a slow web service without holding a thread. Learn the two method pattern, the limits and the alternatives.","breadcrumb":{"@id":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/#primaryimage","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-featured.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/apex-continuation-callouts-featured.png","width":2400,"height":1260,"caption":"Apex Continuation featured image showing a request handed off while the thread is released"},{"@type":"BreadcrumbList","@id":"https:\/\/swapnilzambare.com\/blog\/apex-continuation-callouts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/swapnilzambare.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Apex Continuation for Long Running Callouts Explained"}]},{"@type":"WebSite","@id":"https:\/\/swapnilzambare.com\/blog\/#website","url":"https:\/\/swapnilzambare.com\/blog\/","name":"Swapnil Zambare - Blog","description":"Salesforce &amp; Tech Guides","publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/swapnilzambare.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/swapnilzambare.com\/blog\/#organization","name":"Swapnil Zambare - Blog","url":"https:\/\/swapnilzambare.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","width":512,"height":512,"caption":"Swapnil Zambare - Blog"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/in\/theSwapnilZambare"]},{"@type":"Person","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/10b09224c8bcc562716e86789427592a","name":"Swapnil Zambare","sameAs":["https:\/\/swapnilzambare.com\/blog"],"url":"https:\/\/swapnilzambare.com\/blog\/author\/swapnil-zambare\/"}]}},"_links":{"self":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/2488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/comments?post=2488"}],"version-history":[{"count":2,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/2488\/revisions"}],"predecessor-version":[{"id":3399,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/2488\/revisions\/3399"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media\/2485"}],"wp:attachment":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media?parent=2488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/categories?post=2488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/tags?post=2488"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=2488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}