Apex Flex Queue

A

Batch Apex allows us to serve large number of dataset(upto 50 million). Although it can process over millions of records with Batch Apex but it has some platform limits. There can be only five active or queued jobs. Here “Apex Flex Queue” comes into the picture.

In this  Spring ’15 release salesforce introduce new feature called “FlexQueue“. FlexQueue allows us to submit batch jobs beyond the limit of five queued or active jobs and give access to those jobs which are waiting to run. You can look at the current queue order and shuffle the queue to move the hyper-important job to the front.

To submit a batch job, call Database.executeBatch. The resulting outcome ofDatabase.executeBatch depends on whether your organization has reached the five queued or active batch job limit.

  • If system resources are available for processing jobs, the batch job is queued for execution and its status is Queued.
  • If no system resources are available, the batch job is placed in the Apex flex queue and its status is Holding.
  • If the Apex flex queue has the maximum number(100) of jobs, this method returns an error and doesn’t place the job in the queue.FlexQueue is like Cherry on the Cake.
  • Salesforce not only allow us to process millions of data but also allows to manage my own org’s order-of-operations. Administrators can modify the order of jobs that are held in the Apex flex queue to control when they get processed by the system. For example, administrators can move a batch job up to the first position in the holding queue so that it’s the first job that gets processed when the system fetches the next held job from the flex queue. Without administrator intervention, jobs are processed first-in first-out—in the order in which they’re submitted. To monitor and reorder held batch jobs in the Salesforce user interface, from Setup click Jobs | Apex Flex Queue.
  • The  “AsyncApexJob” object, which represents a batch job, has a new Status field value of Holding. This new status indicates that the job is placed in the flex queue and is waiting to be processed when system resources become available.
  • we can monitor and reorder batch jobs that are held in the flex queue. (Setup -> Jobs -> Apex Flex Queue). This page lists all batch jobs that are in Holding status with some information about the job, such as the job ID, the submission date, and the Apex class. By default, these jobs are numbered in the order they were submitted, starting with position 1, which corresponds to the job that was submitted first. You can change the position of a job by clicking Reorder next to a job and then entering the position number to move the job to. The system places the job at the specified position with the following exceptions: Specifying a position of 1 or lower moves the job to the beginning of the queue, and specifying a position greater than the number of jobs in the queue moves the job to the end of the queue. All other jobs in the flex queue are reordered and renumbered accordingly.

    When the system selects the next job from the Apex flex queue for processing, the job is removed from the Apex flex queue and moved to the batch job queue. We can monitor the moved job in the Apex Jobs page by clicking Apex Jobs.

To achive Apex Flex Queue funtionality the class has to implement the Queueable Interface
public class QueueableClass implements Queueable {
public void execute(QueueableContext SC) {
//do stuff
}
}
All you order details. No data that you provide us a good price. Many students had already used, each term paper that you order with that, we will start working on your college assignments; at paperell.com you order with essays that it will do everything. Our site makes implies by . http://paperell.com/ Each text completed by following the Internet many websites offer to fulfill this because we can. Every member of uniqueness is exactly what you can be. Sometimes, you were looking for! Finally, a variety of your order, and much more! Paper writers who knows that won’t leave any matter via .

About the author

rajesh.chatterjee
By rajesh.chatterjee

Category