[SalesForce] When to use queue and future method in salesforce

When to use queue and future method in salesforce?

what is main difference between queue and future method in salesforce?

Best Answer

You can find you answer on This link. I have pasted differences below as well -

Queueable jobs provides following additional benefits -

Queueable jobs are similar to future methods in that they’re both queued for execution, but they provide you with these additional benefits.

Getting an ID for your job: When you submit your job by invoking the System.enqueueJob method, the method returns the ID of the new job. This ID corresponds to 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 by starting a second job from a running job. Chaining jobs is useful if you need to do some processing that depends on another process to have run first.

Related Topic