Monitor MFT resources
We can monitor Managed File Transfer resources; for example, a queue or a directory. When a condition on this resource is satisfied, the resource monitor starts a task, such as a file transfer. We can create a resource monitor by using the fteCreateMonitor command or the Monitors view in the Managed File Transfer plug-in for IBM MQ Explorer.
About this task
A common scenario is to monitor a directory for the presence of a trigger file. An external application might be processing multiple files and placing them in a known source directory. When the application has completed its processing, it indicates that the files are ready to be transferred, or otherwise acted upon, by placing a trigger file into a monitored location. The trigger file can be detected by a Managed File Transfer monitor and the transfer of those files from the source directory to another Managed File Transfer Agent is initiated.
Two examples of monitoring a directory are as follows:Do not create a monitor that monitors for *.zip, and then transfers *.zip. The monitor tries to start a transfer of *.zip for every .zip file on your system. That is, the monitor generates * number of transfers for *.zip.
- Monitor for a trigger file (for example trigger.file) and then transfer a wildcard (for example, *.zip)
- Monitor for *.zip and then transfer ${FilePath} (for example, the file that triggered the transfer). For more details about variable substitution, see Customizing MFT tasks with variable substitution.
To see an example of creating a resource monitor to monitor a directory, see Monitor a directory and using variable substitution.
An example of monitoring a queue is as follows:For an example of creating a resource monitor to monitor a queue, see Example: Configuring an MFT resource. Managed File Transfer resource monitoring uses the following terminology:
- An external application might be generating messages and placing them on a known queue with the same group ID. When the application has completed putting messages on the queue, it indicates that the group is complete. The complete group of messages can be detected by a Managed File Transfer monitor and the transfer of the group of messages from the source queue to a file is initiated.
- monitor
- A process that polls a resource (such as a directory or queue) at a predefined regular interval to see if the resource contents have changed. If they have, the contents are compared with the set of conditions for this monitor. If there is a match, the task for this monitor is started.
- resource
- The system resource the monitor examines every poll interval to be compared with the trigger conditions. Queues, directories, or nested directory structures can be the monitored resource.
- condition
- An expression that is evaluated (typically against the content of the monitored resource). If the expression evaluates to true, the condition contributes to the overall trigger condition.
- trigger condition
- The overall condition, which is satisfied when all conditions are satisfied. When the trigger condition is satisfied the task can proceed.
- task
- The operation that is started when the trigger condition or set of conditions is satisfied. Supported tasks are file transfer and command call.
- trigger file
- A file that is placed in a monitored directory to indicate that a task (typically a transfer) can begin. For example, it might indicate that all the files to be processed have arrived in a known location and can be transferred or otherwise acted upon. The name of the trigger file can be used to specify the files to be transferred by using variable substitution. For more information, see Customizing MFT tasks with variable substitution.
The trigger file is also known as ready file or go file. However, in this documentation it is always referred to as the trigger file.
From IBM MQ Version 9.0.3, Managed File Transfer includes resource monitor logging. For more information, see Logging MFT resource monitors.
Resource monitoring is not supported on protocol bridge agents or Connect:Direct® bridge agents.