How are triggers executed?
Posted by Van Glass on 20 July 2009 07:26 AM
Triggers listen for server events. Server events are actions that happen on the server, for example, a file is uploaded, user logs in, file deleted etc. You may define triggers that listen for these events and respond based on your business requirements. For example, when a file is uploaded you may want to perform some sort of action against that file. This can easily be done using a trigger.|
When a server event is fired triggers are executed using the following logic:
1. Triggers matching event type are identified.
2. The optional condition(s) for each trigger matching event type are evaluated against event properties to see if the trigger meets conditions. Conditions are ways in which you can filter server events. For example, you may want to listen for the File Upload event, but rather than listen for all file upload events you may want to narrow this down to a specific user. This can be done using an event condition.
3. Triggers are then sequentially loaded for execution. If multiple triggers are found matching both event type and conditions then the order in which triggers will be loaded is defined in the Triggers module of JSCAPE MFT Server Manager. The "Up" and "Down" buttons in this panel allow you to control the order in which the triggers are loaded for execution.
4. Triggers are executed. Execution of a trigger involves executing the actions associated with the trigger. If a trigger has multiple actions then these actions are executed in order. You can define the order of these actions when creating a trigger. If any action fails then a Trigger Error event is raised and subsequent actions for this trigger are NOT executed. You can capture these error events by creating a trigger that listens for the Trigger Error event. While the failure of an action in a trigger WILL prevent execution of subsequent actions for that trigger it WILL NOT prevent the execution of different triggers listening for the same event. For example, if both triggerA and triggerB are listening for the File Upload event and action1 of triggerA fails, this WILL prevent the execution of subsequent actions for triggerA, but this WILL NOT prevent the execution of triggerB and it's actions.
There is a known issue in version 5.2 of JSCAPE MFT Server in that if an action fails then subsequent actions WILL be executed. This issue has since been resolved and will be included in the upcoming 6.0 release.