Queueable Apex
Earlier I wrote a blog post dedicated to Asynchronous processing in Salesforce. This time I will focus on Queueable Apex only.Queueable Apex is a more advanced version of future methods. It has all the functionalities of the future method along with the power of Batch Apex. So – Queueable Apex = Future Method + Batch ApexIt provides additional job chaining and allows for more complex data types.With Queueable Apex, developers will be able to submit jobs for asynchronous processing, like something future method can do as well. But the difference comes here -Flexibility in method parameters: With Queueable Apex, developers will be able to create classes that will allow member variables of non-primitive data types like sObjects or custom Apex types. Monitor the progress: Once the developer submits a job by executing the command System.enqueuJob, it provides an ID, which is basically a Job Id. With that Id, the developer can now query the progress either from Salesforce interface in the Apex Job page or by querying the AsyncApexJob table.Chaining jobs: Developer can now chain jobs i.e. starting a new queueable job from an already running queueable job.Batchable vs Future vs QueueableBatchable was the first one introduced by Salesforce for asynchronous heavy processing. It was “heavy” in terms of resource usage and also needs longer time to process/complete the work.To solve the problem with Batchable, Salesforce introduced the Future method. It...
Read More