The Apex Flex Queue brings an eagerly awaited update to batch Apex processing, allowing more jobs to be submitted at once and bringing greater control over queued jobs. Join us for an early look at this exciting new pilot feature.
1. Apex Liberation
Carolina Ruiz Medina
Principal Developer in Product Innovation Team at FinancialForce.com
@CarolEnLaNube
2. Safe Harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of
the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking
statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service
availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future
operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of
our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service,
new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or
delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and
acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and
manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization
and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our
annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and
others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be
delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available.
Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
4. About FinancialForce.com
• San Francisco Headquarters
• Harrogate, UK
• Granada, Spain
• Toronto, Canada
• Manchester, US
• Opening Sydney, AUS in Sept, 2014
• 350+ Employees
• 400+ by 12/31/2014
• Customers in 31 countries
• 80% Y-o-Y revenue growth
• Advent commitment of $50 million
5. Before
Asynchronous to process large amount of data
• @Future
• Batch Jobs
• Schedule Jobs
• Which
options do
we have?
What is it?
6. Before
• The methods execute when
Salesforce has available
resources
• @future only
returns void type
• No job ID for @future jobs
• Parameters must be @Future
primitive data types
We can’t monitor
the future jobs
• Future methods must
be static methods
• The method does not
necessarily execute in
the same order is
called
7. Before
public with sharing class FutureClass {
@future
static void myMethod(String a, Integer i) {
System.debug('Method called with: ' + a + ' and ' + i+'... and I loved the sunny days :)');
// Perform long-running code
}
}
8. Before:
Batch Jobs
Before
• Database.executeBatch
returns Id
• We can monitor the batch jobs
• We can’t order
batch jobs
• Only 5 active jobs are
allow in the queue at the
same time ( //show error )
• Interfaces that we can
override in order to
process data
• Recursive calls
• Possibility to use iterator
– process different objet
type in the same batch
9. BBeefofroer: e
public class UpdateAccountFields implements Database.Batchable<sObject>{
public final String Query; public final String Entity;
public final String Field; public final String Value;
public UpdateAccountFields(String q, String e, String f, String v){
Query=q; Entity=e; Field=f;Value=v;
}
public Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);
}
public void execute(Database.BatchableContext BC,
List<sObject> scope){
for(Sobject s : scope){s.put(Field,Value);
} update scope;
}
public void finish(Database.BatchableContext BC){
}
}
13. and Now..
Asynchronous
• @Future
• Batch Jobs : With FlexQue
• Schedule Jobs
• Queueable Interface
14.
15. Flex Queue
More than 5 Apex Jobs
More than 5 Apex Jobs in the Apex Jobs Table
5 Apex Jobs Processing + 95 Apex Jobs Holding
New UI to monitor and manage the Apex Jobs in Holding Status
Reorder the holding Apex Jobs
Now
16. Flex Queue
More than 5 Apex Jobs
More than 5 Apex Jobs in the Apex Jobs Table
Now
Show me!
17. Flex Queue
More than 5 Apex Jobs
More than 5 Apex Jobs in the Apex Jobs Table
5 Apex Jobs Processing + 95 Apex Jobs Holding
Now
I don’t believe you, show that!
18. Flex Queue
More than 5 Apex Jobs
More than 5 Apex Jobs in the Apex Jobs Table
5 Apex Jobs Processing + 95 Apex Jobs Holding
New UI to monitor and manage the Apex Jobs in Holding Status
Now
Where is it? How does it work?!
19. Flex Queue
More than 5 Apex Jobs
More than 5 Apex Jobs in the Apex Jobs Table
5 Apex Jobs Processing + 95 Apex Jobs Holding
New UI to monitor and manage the Apex Jobs in Holding Status
Reorder the holding Apex Jobs
Now
Lets reorder then!
20. Flex Queue
Then
Maybe you are thinking now…
• Schedule Jobs: do they work in the same way?
Yes, everything continues exactly the same. The benefit is now we can
schedule and run jobs that call apex jobs having the benefit of Flex Queue
that allow us to set the Batch in Holding status
• Can I reorder using any apex Method?
• Can I abort the Holding Jobs by UI or using System.Abort?
22. Taking
Care!!
With a big power became a big responsibility
• Only re order when necessary
• If there are batch jobs that are dependent to others!
• If there are chaining batch jobs
23. Extra
public class AsyncExecutionExample implements Queueable {
public void execute(QueueableContext context) {
Account a = new Account(Name='Acme',Phone='(415) 555-1212');
insert a;
}
}
Submit and Monitor Jobs for Asynchronous
Execution with the Queueable Interface
ID jobID = System.enqueueJob(new AsyncExecutionExample());
AsyncApexJob jobInfo = [SELECT Status,NumberOfErrors FROM AsyncApexJob WHERE
Id=:jobID];