Activity › Forums › Salesforce® Discussions › What is the difference between Salesforce Batches and Queueable Apex?
Tagged: Apex, Apex Scheduled Jobs, Asynchronous Process, Batch Class, Concurrent Batch, Developer Edition, Queueable Apex, Salesforce Batch, SObjects
-
What is the difference between Salesforce Batches and Queueable Apex?
Posted by shariq on July 17, 2017 at 1:39 PMWhat is the difference between Salesforce Batches and Queueable Apex?
Bhavesh replied 6 years, 3 months ago 4 Members · 3 Replies -
3 Replies
-
Batchable Interface
Complex long running processes (thousands of records)
– Asynchronous processing – Scheduled jobsQueueable 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 - [adinserter block='9']
-
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
-
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.