You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Question

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:

 ...
 if (FileName.FilterMatch1 = true)
 \{
            Call Task FilterMatch1Execute();
 \}
 elseif (FileName.FilterMatch2 = true)
 \{
            Call Task FilterMatch2Execute();
 \}
 else \{
            Call Task NoMatchExecute();
 \}
 ...

…or a switch case or what have you.

Answer

You set up a job chain, using regular expressions to test for different file names.
Note that JobScheduler is able to use full regular expressions to carry out these tests.

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

Text

Text

The job-chain source code is:

 <?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) 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:

  • No labels