Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You set up a job chain, using regular expressions to test for different file names http://www.sos-berlin.com/doc/en/scheduler.doc/xml/file_order_source.xml file_order_source objects. These objects poll (Unix systems) or use the host computer's BIOS (Windows systems) 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 a job in the job chain that is also specified for the file_order_source object.

Note that JobScheduler is able to use full uses regular expressions to carry out these tests, which allows more sophisitcated search patterns than so called "wildcards".

Configuration in JOE

The logic behind the job chain is shown in the following screen shot of the JOE "Diagram" tab:

Text
Image Removed

Text
Image Removed

...

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:

Image Added

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:

Image Added

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 file_order_source is triggered.
Code Block
languagehtml/xml
 <?xml version="1.0" encoding="iso-8859-1"?>
 <job_chain  orders_recoverable="yes">
    <file_order_source  directory="\\asc-stg1p\hshare\ftptest\1420\Inbound\" regex="^08.*\.zip$|^13.*\.pgp$" next_state="NoNZ_checkSteadyState"/>
    <file_order_source  directory="\\asc-stg1p\hshare\ftptest\1420\Inbound\" regex="(^01.*|^02.*|^03.*|^04.*|^05.*|^06.*|^07.*|^09.*|^10.*|^11.*|^12.*|^14.*|^15.*|^16.*|^17.*|^18.*)\.pgp$" next_state="NZ_checkSteadyState"/>
 
    <job_chain_node  state="NoNZ_checkSteadyState" job="../checkSteadyState" next_state="NoNZ_setParams" error_state="!checkSteadyState" on_error="suspend"/>
    <job_chain_node  state="NoNZ_setParams" job="setParams-asc-stg1p-hshare-ftptest-1420-Inbound-NoNZ.pgp" next_state="step1" error_state="!NoNZ_setParams" on_error="suspend"/>
 
    <job_chain_node  state="NZ_checkSteadyState" job="../checkSteadyState" next_state="NZ_setParams" error_state="!checkSteadyState" on_error="suspend"/>
    <job_chain_node  state="NZ_setParams" job="setParams-asc-stg1p-hshare-ftptest-1420-Inbound-NZ.pgp" next_state="step1" error_state="!NZ_setParams" on_error="suspend"/>
 
    <job_chain_node  state="step1" job="../startJob" next_state="success" error_state="!step1" on_error="suspend"/>
 
    <job_chain_node.end  state="!checkSteadyState"/>
    <job_chain_node.end  state="!NoNZ_setParams"/>
    <job_chain_node.end  state="!NZ_setParams"/>
    <job_chain_node.end  state="!step1"/>
    <job_chain_node.end  state="success"/>
 </job_chain>

A job chain can have more than one file watcher (regexp). Every regexp can have a (different) _order_source and its associated regular expression and next_state. Here, the next_state assigned. This is the state , where the job chain has to start processing. In this case, we have two different steps, one to check the steady state one to set the parameter for the "startJob".

See also: