A number of approaches to more reliable scheduling and continuous processing have been used over time on the Salesforce platform, all of them suffering from serious drawbacks. These include:
- suicidal scheduling, where a scheduled job enqueues another scheduled job and then aborts itself. Salesforce has been threatening to penalise the approach with no less than 5 minute delay. Job execution is not reliable.
- chained queueables, where a queuable calls itself. Salesforce states that the back-off for that will top at around a minute. Job execution is also not reliable. Hard to test in developer orgs.
- chained batch jobs, where a batch job calls itself. The newer
BatchApexErrorEventalso offers a way to handle limit exceptions. Salesforce has a back-off for this job type as well, topping at around 4 minutes. Again, job execution is not reliable.
- virtual batches, where a custom iterable class essentially produces a range of numbers, and actual work and querying is done inside batch scopes. Shares similar problems with other job-based approaches.
@RemoteActionmethods are used from a browser to drive execution. Users have to keep their browser windows open.
- API calls, where an external system is in charge of execution scheduling and calls in to Salesforce to perform work. While plentiful, API calls are limited and a number of platform users have started with this approach.
Are there any novel approaches that would allow precise scheduling and continuous execution with less drawbacks than the ones above?