+ Start a Discussion
Somnath Paul 3Somnath Paul 3 

Continuation Class v/s Future Call out true

Hi All,

Just wanted to understand the difference between when to use Continutaion Class and when to use @future  (callout = true) in case asynchronous invocation of WS.

In case of imported WSDL, can we call the sync stub class from a method using @future(callout == true) or we have to use asyncWSDLtoApex class passing the continuation object.

Can anyone please explain both the concepts with bit explanation.

Great Thanks
Somnath
Best Answer chosen by Somnath Paul 3
JitendraJitendra
Hi Somnath,
As per me :
When you use @future method, you completly gets disconnected with current transaction and cannot show output of that method on Visualforce page, if you want to...

In case of continuatioon object, User can work on VF page and once output is available, it will be rendered in Visualforce page, means response from Async is still available in Contuniation object.

I will say both are very useful depending in situation. Chances are very high that you will end up with using @future methods more than continuation object. 

You can read about Continuation object on official salesforce blog (https://developer.salesforce.com/blogs/developer-relations/2015/02/apex-continuations-asynchronous-callouts-visualforce-pages.html) and explains it very well.This is another blog post (http://www.jitendrazaa.com/blog/salesforce/continuation-object-in-apex-asynchronous-callouts-for-long-running-request-live-demo/) which might be helpful.

All Answers

JitendraJitendra
Hi Somnath,
As per me :
When you use @future method, you completly gets disconnected with current transaction and cannot show output of that method on Visualforce page, if you want to...

In case of continuatioon object, User can work on VF page and once output is available, it will be rendered in Visualforce page, means response from Async is still available in Contuniation object.

I will say both are very useful depending in situation. Chances are very high that you will end up with using @future methods more than continuation object. 

You can read about Continuation object on official salesforce blog (https://developer.salesforce.com/blogs/developer-relations/2015/02/apex-continuations-asynchronous-callouts-visualforce-pages.html) and explains it very well.This is another blog post (http://www.jitendrazaa.com/blog/salesforce/continuation-object-in-apex-asynchronous-callouts-for-long-running-request-live-demo/) which might be helpful.
This was selected as the best answer
Somnath Paul 3Somnath Paul 3
Thanks Jitendra!!!