What I would like is an example job that does the following:
1) File comes in, is fully downloaded and then kicks off a FolderWatcher Job
2) Based on the criteria the file name matches, it will kick off another task
3) Task 3: Job execution task
I have items 1 and 3, but need an example for item 2 (a task that has some logic to specify which task to call next). Ideally, it would be something akin to:
You set up a job chain, using
file_order_source objects. These objects poll (Unix systems) or use the host computer's operating system (Windows) to monitor a specified directory. When a file is added to this directory a regular expression specified for the
file_order_source object is used to test for a specific pattern in the file's name. A pattern match in the file name causes JobScheduler to generate an order for the job chain. This order will start at the node in the job chain, whose name has specified in JOE as the "start node" and that is also specified for the
file_order_source configuration using the
Configuration in JOE
The logic behind the job chain is shown in the following screen shot of the JOE "Diagram" tab:
One of the two "checkSteadyState" jobs will be started when a file whose name matches a particular pattern is added to a particular directory as described above.
Once either of these "checkSteadyState" jobs has been completed, the corresponding "setParams" job will be executed before the order proceeds to "step1" in the job chain and then completion (the "success" node).
The job chain is shown in more detail in JOE's "Node" tab as shown in the next screen shot:
The directories that are monitored by the two jobs "checkSteadyState" jobs are set in JOE's "File event" tab as are the regular expressions used to match the pattern in the names of files added to the directories in question. This can be seen in the screen shot below:
In this example, both
file_order_sources monitor the same deirectory but use different regular expressions to filter the files arriving:
- The "NoNZ_checkSteadyState" source checks whether a file of type "zip" whose name starts with "08" or whether a file of type "pgp" whose name starts with "13" has been added to the directory;
- The "NZ_checkSteadyState" source checks whether a file of type "pgp" whose name starts with a number between "01" and "18" (but not "08" or "13") has been added to the directory.
Configuration in XML
The two "checkSteadyState" jobs described above are started by
file_order_source objects. Although notdirectly visible in JOE these are generated by JOE in the background and can be seen in lines 2 and 3 of the XML listing of the job chain (see below). The
file_order_source object parameters have the following purpose:
- "directory" is the directory being monitored,
- "regex" is the regularexpression used to match the file name and
- "next_state" is the name of the job to be started when the
A job chain can have more than one
file_order_source and its associated regular expression and
next_state. Here, the
next_state is the state where the job chain has to start processing.