Join us to understand what Asynchronous Process means and learn about techniques to use them on the Platform. Determine Why, Where & When to use these processes. Discuss various pros/cons about each of the techniques and take a look at some of the real time examples. We will discuss about using @future methods, Queueable, Batachable Interfaces in Apex, using Platform Events for Async processing. Considerations, monitoring and limits for each of the methodologies
This will be a fast paced webinar that will cover a wide breadth of topics on Asynchronous Processes and you are sure to walk away with ideas & techniques for using these in your day to day job on the Platform.
- Understand what Asynchronous Process is and why it is needed.
- Learn about various Asynchronous capabilities available on the platform
- Compare between using @future, Queueable and Batchable techniques
- Using Platform Events for Async Processing
- Async Apex triggers
- See multiple real time demo that we have built.
Here is some keynote of session
In technology terminology, Asynchronous operation means that a process operating independently of other processes
Asynchronous vs Synchronous
- Actions that will not block the transaction or Process
- Duration is not priority
- Higher Governor limits
- Quick and Immediate actions
- Transactions are immediate and serial
- Normal Governor Limits
Asynchronous Process on Salesforce Platform
- Ensure fairness of processing – Make sure every customer gets a fair chance at processing resources.
- Ensure transactional capabilities – Ensure equipment or software failures allow continued processing at reduced capacity and requests are persisted until completion.
Queue based framework
- Enqueue – The request gets put into the queue. This could be an Apex batch request, @future Apex request or one of many others. The Salesforce application will enqueue requests along with the appropriate data to process that request.
- Persistence – The enqueued request gets persisted. Requests are stored in persistent storage for failure recovery and to provide transactional capabilities.
- Dequeue – The enqueued request is removed from the the queue and processed. Transaction management occurs in this step to assure messages are not lost if there is a processing failure.
Using Async in Salesforce – how will we do it?
- Schedule & Batch jobs
- Change Data Capture – Apex Triggers (Summer ’19)
- Platform Events – Event Based
- Continuations (UI)
Why to use Anyc process Scenarios
- Integrations to External Applications
- Long running processes
- Mixed DML Operations
- Large volume of data loads & transactions
Using @future annotation
- A “set it and forget it” method
- Call it and the async job is launched
- No ability to monitor the job
- Cannot chain @future calls
- A public static method, decorated with @future
- Arguments: Primitives (Integer, String, etc.)
- Collections of primitives (List, Map, Set)
- NOT SObjects or Apex objects
- You can use JSON.serialize() and pass in a String
- Returns void
- A class and method that can be added to the queue to be executed
- It’s monitorable and abortable
- It’s chainable
- A public class that implements the Queueable interface
- Includes an execute method that accepts only a QueueableContext parameter
- The execute method can access instance properties for the class
- Returns void
- Launch by calling System.enqueueJob(cls) with an instance of the class.
- Returns an AsyncApexJob Id
Using Batch Class
- A technique designed specifically for:
- Processing large numbers of records
- Doing more work than can be done in a single transaction
- It’s monitorable and abortable
- A global class that implements the Database.Batchable interface
○Start method – identifies the scope (list of data to be processed)
○Execute method – processes a subset of the scoped records
○Finish method – does any post-job wrap-up
- Additional interfaces:
- Launch by calling Database.executeBatch(cls) with an instance of the class and an optional scope size
- Default scope size is 200
- Max scope size is 2,000
- Returns an AsyncApexJobId
- A global class that implements the Schedulable interface
- Includes an execute method
- Schedule by calling
- System.Schedule(‘job name’, cron expression, cls)
- Cron expression can be complex
- Returns a CronTrigger Id
- Can also schedule via the Salesforce UI
- seconds minutes hours day_of_month month day_of_week optional_year
Run at 30 minutes past midnight on Jan 1 every year
- GeocodingSchedulable cls = new GeocodingSchedulable();
System.Schedule(‘Geocode on Jan 1’, ‘0 30 0 1 1 ? *’, cls);
Run every hour
- System.Schedule(‘Geocode hourly’, ‘0 0 * * * ? *’, cls);
Here is Recording of session.
Speaker : Kartik Viswanadha
Date : Saturday, 15 JUNE 2019 10:00 AM EST ( 7:30 PM IST)
Please note that we have limit of 100 attendees that can join the online sessions. However, recording will be posted on our YouTube channel. Make sure to subscribe our YouTube channel to get notification for video upload.
Check our “Session in 2019” page for all upcoming and old sessions of 2019.
Sharing is Caring so Share with your friends
Salesforce Apex Hours
283 total views, 1 views today