Trigger lifecycle

Top  Previous  Next

To benefit fully from the use of triggers you may find it helpful to understand the lifecycle of a trigger.  This is explained below.


1. Raise event


The first step in trigger lifecycle starts with an event.  There are a number of events that can be listened for in a trigger.  Examples of these are provided below.


Current Time


This event is automatically raised every minute and can be used for scheduling triggers.


File Upload


This event is raised anytime a file is uploaded via on of the file transfer services provided by the server.


User Login


This event is raised anytime a user attempts to login to the server.


For a complete list of available events please see the Event type field when adding or editing a trigger.


2.  Identify matching triggers


The next step in the trigger lifecycle is to identify those enabled triggers that are listening for the event type raised.  For example, in the case where a File Upload event is fired all triggers listening for the File Upload event will be identified.


3.  Filter trigger conditions


Next in the trigger lifecycle is to filter those matching triggers even further, excluding those that do not match trigger conditions that may have been specified.  To explain, each event has a set of properties that are set when the event is raised.  These properties can be accessed in trigger conditions and trigger actions using event variables.  For example, a trigger may choose to listen only for File Upload events where the login of the user that uploaded the file matches a specific value.


Example Condition


Username = "test"


Note, each event has different event variables available to it.  For example, the File Upload event has a LocalPath variable that may be used to identify the absolute path of the file uploaded.  This variable however is not available in the User Login event.


To see what variables are available for each event type please use the Variables button when adding a condition or the Add Variable button when adding an action to a trigger.


See also


Writing conditions


4.  Prepare for execution


Now that triggers have been identified and filtered, the next step is to prepare for the execution of those triggers.


Each trigger may be executed in asynchronous (concurrently) or synchronous (sequentially) mode depending on the settings for the individual trigger. The default is synchronous. At this point in the lifecycle, these triggers are split into two separate queues, one for asynchronous triggers and another for synchronous triggers.  Those triggers in the asynchronous queue are executed first, followed by those in the synchronous queue.  Those triggers in the synchronous queue are executed in the order they are defined in the Triggers module of MFT Server.  The order of execution for synchronous triggers can be controlled using the Order button with those triggers located at the top taking priority.


Note, depending on the optional settings in the Triggers > Settings panel of MFT Server you may limit the number of triggers that will execute concurrently.  Those triggers that are waiting to  be executed will have a status of pending in the Triggers > Recent panel of MFT Server.


Also note that any functions that are used in the trigger Conditions or the trigger Actions will be executed at this time, not when the actions are executed.


5.  Execute trigger


For each trigger there are one (1) or more actions to execute.  Depending on the settings for the individual trigger, actions are executed asynchronous (concurrently) or synchronous (sequentially).


Upon execution, trigger actions may succeed or fail. Actions may be configured so that a success and/or failure results in the execution of another trigger action(s).


Figure 292





In the event that an action fails, a Trigger Error event is raised. In addition, in the event that the trigger is set to run actions in synchronous mode, subsequent actions will not be executed. To listen for these errors a separate trigger that listens for the Trigger Error event may be used.  Triggers that fail execution will have a status of failed in the Triggers > Recent panel of  MFT Server.


Triggers that successfully execute will have a status of completed in the Triggers > Recent panel of MFT Server.


6.  Log results


The full lifecycle of a trigger is written to the server log for historical and auditing purposes.  You may also view the status of the most recent triggers in the Triggers > Recent panel of MFT Server.

Home | Company | Products | Solutions | Purchase | Support | Services | Blog

© 2022 Redwood Software, Inc.