File watch triggers are triggered when a file matching the File filter is saved to the Directory path to watch.
The trigger watches for new files added to the watched directories, e.g. a newly created file will cause the trigger to launch a process, but if that file is left in the directory and modified, that will not cause a new execution. The file watch also checks the files in the directory every 10 seconds.
The trigger keeps track of files it has already processed by their file names. This means that it will not notice if you e.g. overwrite the file, or quickly delete a file and then create a new one with the same name. It may take up to the max poll delay of 10 seconds to notice a file has been removed.
NOTE: It is recommended to always clear the files from the watched directories after processing, because keeping track of them takes up resources. If you would have thousands of files in the folder, the processing may slow down.
NOTE: In an HA Agent Group, the watched directory should be accessible from all the Agents in the same Agent Group. Otherwise the other Agents will see the file as missing from the watched folder and remove it from tracking causing the file to be processed again.
File watch trigger can define:
Name– Descriptive name for the trigger
Directory– Directory path from where the files will be fetched.
File filter– File filter to use (e.g. '*.xml'). Wildcards are described here.
Include sub directories– If enabled, fetches all the matching files also from subdirectories.
Maximum number of files to process at a time– Maximum number of files to process at a time. The trigger will process only max 1000 files at a time.
Quiet period in seconds– Time in seconds, the trigger will wait since the last file write time before processing the file. NOTE: the operating system may not always update the last write time for a file for performance reasons. Therefore always set the value to be large enough to take this account when using this setting.
Poll interval in seconds– Time before files are processed again.
Username– If the username field is used the File Trigger will not use the Frends Agent account credentials to poll for files but a different account. Expected input is domain\username
Password– The password for the user above
File Trigger parameters, especially
Directory, are not Text or Expression fields familiar from the other Process elements. Instead they behave like Text fields, with the exception that you can use Environment variables without handlebars. For example if you have
C:\EaiFiles stored in environment variable
#env.EAI, then you could have
Directory configured as
#env.EAI\In. It would then watch folder
Once the process is triggered by a file, the file paths available to the process via the
#trigger.data.filePaths. It is array System.Object containing strings (file paths). For more details, there is also the
#trigger.data.files reference, which returns a array of objects with the following properties:
FileChangeType- Always "Created"
FullPath- Full path to the file
FileName- Name of the file