How to use cron expressions for scheduling tasks in the Timer activity
This article details how to leverage cron expressions for scheduling tasks within the Timer activity, a useful feature introduced in TIBCO BusinessWorks 6.11 and BusinessWorks Container Edition 2.10.
How to configure a cron schedule in the Timer activity
This can be done by using the following configuration options:
. Check the ‘Cron Job’ option
. Enter the cron expression
. Enter the ‘End Time’ (it is recommended to set it to a far future date)
For example, with the configuration below the Timer activity will trigger at 9:15:00 every working day of the week (from Monday to Friday):
Definition of the cron schedule
Behind the scene the Timer activity is using the Quartz Scheduler to manage the cron schedules.
Details about the syntax to use to set the cron schedule can be found in the Quartz documentation, note that it is a bit different from the Linux crontab syntax:
https://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html
Important elements
Something important to consider is that when the Timer activity is activating, at application start-up, after a fail-over or on an administration command request, if the date or time specified in the cron expression is in the future compared to the ‘Start Time’ configured in the Timer activity the Timer will trigger once (this is the default Quartz behavior — I think this assume that the previous triggering has been missed).
This can be managed in the process logic by just checking the current date or time before starting processing or filtering possible duplicates using a file or a database table to persist the date and time of the last successful execution.