[SalesForce] Lightning components and Continuations

I have a need to design components that are capable of performing a lot of simultaneous callouts. Platform limit is 20 per host.

Continuations are great way to avoid this limit.

Problem is, as per Lightning design doc, apex class methods must be static:

"Methods must be static and marked public or global. Non-static methods are not supported."

In my understanding we need a persistent class in apex to initiate continuation and capture results on the instance of the class when request is fulfilled, later we could check from frontend if results are populated.

So, what approach should I take to be able to use Lightning components with secure backend callouts not hitting platform limits?

Best Answer

After working with Salesforce on this I got interim workaround until continuations are supported by Lightning framework.

Create a Visualforce page what will be performing callouts using continuations and collecting responses on the page via backend rendered JS vars. Use Window.postMessage() to communicate and exchange data between lightning component and iframe.

Related Topic