+

Search Tips   |   Advanced Search

xJCL sample for a batch job

The following sample illustrates a batch job, which demonstrates that we can invoke existing session beans from within job steps.

<job name="PostingsSampleEar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    
    <jndi-name>ejb/com/ibm/websphere/samples/PostingsJob</jndi-name>
       
    <step-scheduling-criteria>
        <scheduling-mode>sequential</scheduling-mode>
    </step-scheduling-criteria>
    
    
    <checkpoint-algorithm name="${checkpoint}">
        <classname>com.ibm.wsspi.batch.checkpointalgorithms.${checkpoint}</classname>
        <props>
            <prop name="interval" value="${checkpointInterval}" />
        </props>
    </checkpoint-algorithm>

        
    <results-algorithms>
        <results-algorithm name="jobsum">
            <classname>com.ibm.wsspi.batch.resultsalgorithms.jobsum</classname>
        </results-algorithm>
    </results-algorithms>
    
        
    <substitution-props>
        <prop name="wsbatch.count" value="5" />
        <prop name="checkpoint" value="timebased" />
        <prop name="checkpointInterval" value="15" />
        <prop name="postingsDataStream" value="${was.install.root}${file.separator}temp${file.separator}postings" />
    </substitution-props>

    <job-step name="Step1">
        
        
        <jndi-name>ejb/DataCreationBean</jndi-name>
        
        <!-- apply checkpoint policy to step1 -->
        <checkpoint-algorithm-ref name="${checkpoint}" />
        
        
        <results-ref name="jobsum"/>

        
        <batch-data-streams>
            <bds>
                
                <logical-name>myoutput</logical-name>
                
                
                <impl-class>com.ibm.websphere.samples.PostingOutputStream</impl-class>
                
                <props>
                    
                    <prop name="FILENAME" value="${postingsDataStream}" />
                    
                </props>
            </bds>
        </batch-data-streams>
                
        
        <props>
            
            <prop name="wsbatch.count" value="${wsbatch.count}" />
        </props>
    </job-step>


    <job-step name="Step2">
        
                
        <step-scheduling condition="OR">
            <returncode-expression step="Step1" operator="eq" value="0" />
            <returncode-expression step="Step1" operator="eq" value="4" />
        </step-scheduling>
                
        <jndi-name>ejb/PostingAccountData</jndi-name>
        <checkpoint-algorithm-ref name="${checkpoint}" />
        <results-ref name="jobsum"/>

        <batch-data-streams>
            <bds>
                
                <logical-name>myinput</logical-name>
                <impl-class>com.ibm.websphere.samples.PostingStream</impl-class>
                
                
                <props>
                    <prop name="FILENAME" value="${postingsDataStream}" />
                </props>

            </bds>
        </batch-data-streams>
    </job-step>

         <job-step name="Step3">
       <step-scheduling>
           <returncode-expression step="Step2" operator="eq" value="4" />
       </step-scheduling>

       <jndi-name>ejb/OverdraftAccountPosting</jndi-name>
       <checkpoint-algorithm-ref name="${checkpoint}" />
       <results-ref name="jobsum" />

       
      <batch-data-streams>
           <bds>
               
              <logical-name>dbread</logical-name>
               <impl-class>com.ibm.websphere.samples.OverdraftInputStream</impl-class>
          </bds>
      </batch-data-streams>
   </job-step>   
</job>


Related:

  • xJCL elements
  • XML schema for a batch job