A job which processes files laid up in a directory can be used for directory monitoring.
The request
Requests can be repeated for a number of directories.
A request can be included in the JobScheduler script
(Element <script>
in
When a file or a subdirectory is added, deleted or renamed.
The method
When a number of directories are being monitored, the
For non-API jobs (SCHEDULER_TASK_TRIGGER_FILES
.
The JobScheduler interprets the situation of a directory no longer being accessible (i.e. it had been deleted or is no longer available) as a change and starts a task.
A repeated
The following example shows an example configuration for a job which processes all the files in a directory and then deletes them. (Careful when testing - the job really deletes files!)
<?xml version="1.0"?> <spooler> <config> <process_classes/> <jobs> <job name="import"> <script java_class="spooler_job.Import"><![CDATA[]]></script> </job> </jobs> </config> </spooler>