What is Queueable Apex class?

What is Queueable Apex class?

Take control of your asynchronous Apex processes by using the Queueable interface. This interface enables you to add jobs to the queue and monitor them. Using the interface is an enhanced way of running your asynchronous Apex code compared to using future methods.

What is the use of Queueable apex?

Queueable apex is an asynchronous apex method. It’s similar to the @future method. By using this queueable interface, we can process an Apex that runs for a long time (such as web service call outs and extensive database operations). Queueable apex is an asynchronous apex method.

How do I run a Queueable apex in Salesforce?

Execute the Queueable apex with System. enqueueJob method which will return the job Id. Once you enqueue a new job, you get a job ID that you can actually monitor from the ApexJobs sections or by using AsyncApexJob object.

How do you call a Queueable class in Apex?

You can call the queueable class using the enqueue job method. ID jobID = System. enqueueJob(updateJob);

How does the queueable interface work in apex?

The interface has only one method execute which takes the parameter of QueableContext. For Apex processes that run for a long time, such as extensive database operations or external Web service callouts, you can run them asynchronously by implementing the Queueable interface and adding a job to the Apex job queue.

What’s the maximum stack depth for queueable apex?

For Developer Edition and Trial organizations, the maximum stack depth for chained jobs is 5, which means that you can chain jobs four times and the maximum number of jobs in the chain is 5, including the initial parent queueable job. When chaining jobs with System.enqueueJob, you can add only one job from an executing job.

How does transaction finalizers work in queueable apex?

The Transaction Finalizers feature enables you to attach actions, using the System.Finalizer interface, to asynchronous Apex jobs that use the Queueable framework. A specific use case is to design recovery actions when a Queueable job fails.

Which is an example of a queueable job?

When we invoke the queueable job using the system.enquejob () method, this will return the id of the asynchronous job.using which we can track the status of the job. Example: With Queueable apex update the Account records and assign the jobid to description field of account.