Versions Compared

Key

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

Table of Contents
outlinh1. true
outlinh1. true
1printablefalse
2stylh1. none
3indent20px

Starting a job chain from within a running job chain and handing over parameters programmatically can be effected with the following steps.

Display feature availability
StartingFromRelease1
. create a job CallJobchain
.7

The start of additional job chains can be configured within the current job chain configuration, see How to configure workflow control by return code handling. The below information is intended for users who want to apply scripting for an individual solution.

Create a job CallJobChain

Code Block
languagexml
titleconfiguration of the CallJobChain job
collapsetrue
Code Block

 <job order="yes"
     stop_on_error="no"
     enabled="yes"
     >
    <settings>
        <log_level><![CDATA[debug9]]></log_level>
    </settings>
    <params/>
    <script language="javascript">
        <javax.script:ecmascript"><![CDATA[
 function spooler_process()\ {
   var thisOrder = spooler_task.order();
   var order = spooler.create_order();
   var execute_jobchain = thisOrder.params().value("execute_jobchain");
   order.id = thisOrder.id + "_next" ;
   order.params().merge(thisOrder.params);
   spooler.job_chain( execute_jobchain ).add_order( order );
   return true;
 \} 
        ]]>
    <></script>
    <run_time/>
 </job>

2. create a "sync job" named "sync" using the job wizzard in JOE

Create a synchronization job with the name sync

Code Block
languagexml
titleConfiguration of the sync job
collapsetrue
Code Block

 <job title="Synchronize Job Chains"
     order="yes"
     tasks="1"
     enabled="yes"
     >
    <description>
        <include file="jobs/JobSchedulerSynchronizeJobChains.xml"/>
    </description>
    <params/>
    <script language="java"
            java_class="sos.scheduler.job.JobSchedulerSynchronizeJobChains"
            java_class_path=""/>
    <run_time/>
 </job>

...

Create a job chain JobchainSampleChainNext with

...

some nodes and add a node with

...

a synchronization job

...

Code Block
languagexml
titleConfiguration of the job chain JobchainSampleChainNext
collapsetrue

 <job_chain orders_recoverable="yes"
   chain>
        visible="yes"
           >
    <job_chain_node state="100"
                    job="job_sample_4"
                    next_state="sync"
                    error_state="error"/>
    <job_chain_node state="sync"
                    job="Sync"
                    next_state="success"
                    error_state="error"/>
    <job_chain_node state="success"/>
    <job_chain_node state="error"/>
 </job_chain>

...

Create a job chain sampleNestedJobChain

sampleNestedJobchain. One node is assigned to CallJobchain CallJobChain. This  This node sets the parameter execute_jobchain= to the value JobchainSampleChainNext. The sync synchronization job is the succesor of this node.

Code Block
languagexml
titleConfiguration of the job chain sampleNestedJobChain
collapsetrue
 <job_chain>
    
 <job_chain orders_recoverable="yes"
           visible="yes"
           >
    <job_chain_node state="100"
                    job="job_sample_1"
                    next_state="200"
                    error_state="error"/>
    <job_chain_node state="200"
                    job="job_sample_2"
                    next_state="callNext"
                    error_state="error"/>
    <job_chain_node state="callNext"
                    job="CallJobchainCallJobChain"
                    next_state="sync"
                    error_state="error"/>
    <job_chain_node state="sync"
                    job="Sync"
                    next_state="300"
                    error_state="error"/>
    <job_chain_node state="300"
                    job="job_sample_3"
                    next_state="success"
                    error_state="error"/>
    <job_chain_node state="success"/>
    <job_chain_node state="error"/>
 </job_chain>