By default when we poll the file using file adapter, it starts reading the file as soon as we deployed our composite to server. To get more control over it we can use trigger file option available in file adapter.
When we choose “Trigger File” checkbox, file adapter will not poll/read the file/files from specified directory unless it see trigger file in trigger file directory. Once trigger files is there in the trigger file directory, file adapter will start polling the files.
Suppose we have one business scenario, we should not poll/read the files which contain information regarding student unless source system writes all the files to required location. We will use trigger file option available to handle this scenario and polling will only start when source system writes all the files to specified location and put one trigger file to trigger file directory in the end.
To add File adapter to your composite, choose “File Adapter” from service adapters and drag it to the composite.
Choose “Read” operation as we will poll/read the file.
Specify polling file directory and check "Delete files after successful retrieval" if you want to delete the file after reading.
Set the polling frequency.
Check the “Trigger File” option. The trigger file directory can be the same as the inbound polling directory or different from the inbound polling directory. However, if your trigger file directory and the inbound polling directory are the same, then you should ensure that the name of the trigger file is not similar to the polling file.
If you want to use different directory for trigger file then don’t check the “Use directory for incoming files” checkbox and provide trigger directory and file name.
If you want to use same directory for trigger file then check “Use directory for incoming files” checkbox and provide trigger file name.
Browse required schema and choose schema element.
Source system wrote Student.xml file to specified directory but polling didn’t start yet because trigger file is not there.
Once source system place trigger file to specified directory.
Once trigger file is placed in specified directory, file adapter will poll the Student.xml file and process it.