From a naive read of these questions and answers:
- 2012 - Are there best practices to get scheduled apex scheduled to run faster than once per hour?
- 2013 - What will be the cron expression for scheduling a job in every 5 minutes?
- 2013 - Scheduled batch jobs and durability
- 2014 - How to run a scheduled job every 15 minutes?
and given that the "Maximum number of Apex classes scheduled concurrently" limit is now 100, setting up 12 scheduled jobs 5 minutes apart seems like the simple (and durable - see the discussion in Scheduled batch jobs and durability) way of achieving this.
Are there any downsides to this approach given the platform as it is in 2016? Is there a compelling alternative?
(This is not an academic question - looks like we are going to have to do this to work-around a problem so looking for advice. The problem is that some getContentasPdf pages fail to render images stored in Attachments when executed in asynchronous code kicked off from a site. As this processing is asynchronous anyway, looking to execute it in the non-site context where it is known to work via this scheduled code and avoid future context-related surprises.)
Just scanned the "Going Asynchronous" chapter of Dan Appleman's excellent Advanced Apex Programming – 3rd edition and read:
... native chaining support built into queueable Apex, there is no longer a need to use scheduled Apex in this manner ...
but I'm not entirely clear on which of the patterns he describes would fit this case...
So 2 approaches are proposed in the answers but I still have these questions about them:
- "suicide scheduling" but with the advice to also schedule say every hour: what is the best way to ensure that multiple "suicide schedules" don't get created?
- my trivial test of enqueueing at the end of a
Queueableran so fast that a significant part of the asynchronous Apex method executions governor limit might be consumed; is anyone using this approach successfully today?