Activity Forums Salesforce® Discussions What is the difference between Salesforce Batches and Queueable Apex?

  • saloni gupta

    Member
    July 17, 2017 at 1:46 pm

    Batchable Interface

    Complex long running processes (thousands of records)
    - Asynchronous processing - Scheduled jobs

    Queueable Interface

    When Batch and @future need to meet in the middle - Chaining jobs
    - You need @future method with support for non-primitive types
    - Asynchronous monitoring

  • Parul

    Member
    September 16, 2018 at 6:22 am

    Batchable Apex:

    If it is a long-running complex process then you should go for Batchable Apex and you can have an option to schedule the batch to run at a customized time.
    It can process up to 50 million records in asynchronous mode.
    5 concurrent jobs are allowed to run at a time and future methods are not allowed in Batch class.
    Batch Class should implement Database.Batchable interface and it should have three methods start(), execute() and finish() methods.

    Queueable Apex:

    It comes in handy, when you need to have both the operations of Batch and future method and it should implement Queueable Interface.
    If one job is dependent on other job means here we can chain the dependent job in execute method by system.enqueuejob(new secondJob());
    You can also able to chain upto 50 jobs and in developer edition you can able to chain up to 5 jobs only.
    It will accept non-primitive types like sObjects and it also runs in asynchronous mode.
    In this Queueable apex you can get Job Id to monitor the job progress.

    Thanks

  • Bhavesh

    Member
    January 29, 2020 at 6:52 am

    Can i replace my Queueable class to batch class?  It there any example how can i convert my Queueable class to batch?

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos