Triggers
When you create a job, you must specify conditions that will start the job. These conditions are known as triggers.
FlowForce Server continuously checks for trigger conditions and executes jobs whenever specific trigger conditions are met. A job can have multiple triggers. You can enable and disable triggers when necessary.
Jobs with parameters
If you use triggers in a job that has input parameters, all these parameters must have default values; otherwise, the job will not be executed.
Types of triggers
The following types of triggers are available in FlowForce Server:
•Timers allow you to schedule jobs to start at a specific time and run for a certain period. Timers can be set to run daily, weekly, on specific days of the week or month.
•File-system triggers start jobs when there is a change in a file or folder. Note that deleted files cannot be monitored. You can configure the directory polling interval (e.g., every 60 seconds) and optionally set the start and expiry date of the trigger. You can also use wildcards to filter files in a directory.
•HTTP triggers enable you to poll a URI for changes. Specifically, you can poll the Last-Modified and Content-MD5 HTTP header fields for changes. You can configure the polling interval (e.g, every 60 seconds) and optionally set the start and expiry date of the trigger.
Add a trigger
To add a trigger, create a job or open an existing one, navigate to the Triggers section of the job configuration page, and add the relevant trigger.
Enable/disable a trigger
By default, when you create a trigger, the enabled check box is selected, which means the trigger is active. To disable a trigger, clear the enabled check box.
Potential issues
There are situations in which FlowForce Server can disable triggers at runtime to avoid some issues. For example, if FlowForce Server has trouble using credentials, it may disable a trigger to avoid locking the credential. Note trigger behavior in this respect:
•Timers do not require logon to work. Therefore, logon errors are detected only when the job is started.
•Watch triggers (file system and HTTP triggers) require logon to work, as they have to access files in the context of the user.
Overall, FlowForce Server never disables triggers completely. FlowForce Server tries to avoid swamping the system with failed logon attempts that would lead to account lock-out and other issues. Normally, no action is required for triggers if the credentials have not changed, but you can explicitly reactivate the trigger by re-saving the credentials.
Manage a trigger
Use the buttons to the right of a trigger to manage the trigger (see below).
Sets the value of a trigger's parameter (e.g., Start). | |
Deletes a trigger or delete the value of the trigger's parameter (e.g., Repeat). | |
Duplicates a trigger. | |
Undoes the previous delete action. |
Trigger priority (Advanced Edition)
In FlowForce Server Advanced Edition, you can assign priority to jobs in a queue. Priority is estimated based on all the jobs assigned to the queue. Priority can be low, below normal, normal, above normal, or high. The default priority is normal. You can set priority for any trigger type. If your job has multiple triggers configured, you can select different priority values for them, if necessary.
Global queues
Setting trigger priority is particularly relevant to global queues, because you can decide which jobs are more important in a queue and should be fired first. In most cases, a job will have only one trigger. A job whose trigger has a higher priority and whose trigger conditions have been met will fire first.
Assuming there are several jobs in a global queue, and each job has several triggers of different priority, FlowForce will first check the triggers of higher priority. If the triggers' conditions are not fulfilled, FlowForce Server will then go on to check the triggers of lower priority. For a job with several triggers, it would make more sense to set the same priority value for all of them (e.g., high priority if the job is more important than others in the queue).
Local queues
A local queue processes instances of one and the same job. If there is only one trigger configured, the priority value will be ignored. If there are several triggers of different priority, the triggers will compete with each other. For example, a job has a timer and a file-system trigger. The timer has a lower priority, whereas the file-system trigger has a higher priority. If the timer's condition has been fulfilled, and if there are no files to process, the timer will start the job earlier than the second trigger. However, if there are multiple files to process, the timer will wait, and the file-system trigger will be given priority.
The triggerfile parameter
When you create a file-system or HTTP trigger in a job, FlowForce Server automatically adds a triggerfile input parameter to the job (see screenshot below). When the job runs, FlowForce Server sets this parameter to the file that triggers the job (valid for file-system triggers) or the name of the temporary file that contains the downloaded content of the polled URI (applicable to HTTP triggers).
You can pass the value of the triggerfile parameter as an input value in any subsequent steps of the job. This way, you can use or process the triggering file as required. By default, the triggerfile parameter contains the absolute path of the triggering file. To extract portions of the path, use the file-system expression functions. See an example of a job that uses the triggerfile parameter in Creating a Directory Polling Job.