Activity Forums Salesforce® Discussions Explain Queueable apex in salesforce?

  • Deepak

    Member
    September 4, 2019 at 12:56 pm

    The class which implements the Queueable interface are basically called a Queueable apex class. This interface enables you to add jobs to the queue and monitor them, which is an enhanced way of running your asynchronous Apex code compared to using future methods. 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. In this way, your asynchronous Apex job runs in the background in its own thread and doesn’t delay the execution of your main Apex logic. Each queued job runs when system resources become available. A benefit of using the Queueable interface methods is that some governor limits are higher than for synchronous Apex, such as heap size limits.

    It allows you to submit jobs for asynchronous processing similar to future methods with with these additional benefits:
    Non-primitive types: Your Queueable class can contain member variables of non-primitive data types, such as sObjects or custom Apex types. Those objects can be accessed when the job executes.
    Monitoring: When you submit your job by invoking the System.enqueueJobmethod, the method returns the ID of the AsyncApexJob record. You can use this ID to identify your job and monitor its progress, either through the Salesforce user interface in the Apex Jobs page, or programmatically by querying your record from AsyncApexJob.
    Chaining jobs: You can chain one job to another job by starting a second job from a running job. Chaining jobs is useful if you need to do some sequential processing.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos