Chapter 6. WebSphere Batch 147
Figure 6-5 illustrates the main architecture of the batch container. The function that
dispatches the job is the batch container. The batch controller bean controls the batch
application and processes the job definition from start to finish.
Figure 6-5 Batch container view
Batch applications run under the control of an asynchronous bean, which is similar to a
container-managed thread.
6.3.3 xJCL
Jobs are described by using an XML job control language (xJCL) that identifies the batch
application to run. The xJCL definition is similar to a traditional JCL. The xJCL definition of a
job is not part of the batch application. Rather, it is constructed separately and submitted to
the job scheduler to run. The job definition identifies which batch application to run, and its
inputs and outputs. It also identifies which checkpoint algorithms and results algorithms to
use. The job scheduler uses information in the xJCL to determine where and when to run the
job.
WebSphere Application Server
xJCL
WebSphere Application Server
Foundation Services level
(security, transaction, data access, logging, and so forth)
Job steps
Data access
Checkpoins
Results
Java virtual machine
BATCH container
IBM batch
container
classes and APIs
Batch
Controller
Batch
application
148 WebSphere Application Server V8.5 Concepts, Planning, and Design Guide
Figure 6-6 shows an xJCL example.
Figure 6-6 xJCL example
xJCL sample for a compute-intensive job
Example 6-1 shows a generic compute-intensive sample.
Example 6-1 xJCL sample for a compute intensive job
<?xml version="1.0" encoding="UTF-8" ?>
<job name="OpenGrid" class="xyz" accounting="accounting info"
default-application-name="tryit"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<job-scheduling-criteria>
<required-capability expression="someExpression" />
<required-capability expression="anotherExpression" />
</job-scheduling-criteria>
<substitution-props>
<prop name="PATH" value="C:\\windows;C:\\java\\jre\\bin" />
</substitution-props>
<job-step name="Step1" application-name="tryit">
<env-entries>
<env-var name="PATH" value="${PATH}" />
<env-var name="CLASSPATH" value="C:\\windows" />
</env-entries>
<exec executable="java">
<arg line="command line args here" />
<arg line=" and more command line args here" />
</exec>
<?xml version="1.0" encoding="UTF-8" ?>
<job name="name" >
<jndi-name>batch_controller_bean_jndi</jndi-name>
<substitution-props>
<prop name="property_name" value="value" />
</substitution-props>
<job-step name="name">
<classname>package.class </classname>
<checkpoint-algorithm-ref name="chkpt"/>
<resutls-ref name="jobsum"/>
<batch-data-streams>
<bds>
<logical-name>input_stream </logical-name>
<props>
<prop name="name" value="value"/>
</props>
</bds>
</batch-data-streams>
</job-step>
<job-step
</job>
Roughly analogous
to the JOB card
A job step
Similar to the
EXEC PGM=
statement in JCL
Similar to DD
statements
Chapter 6. WebSphere Batch 149
</job-step>
</job>
xJCL sample for a batch job
Example 6-2 shows a sample batch job that demonstrates how to start existing session
beans from within job steps.
Example 6-2 xJCL sample for a batch job
<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>

Get WebSphere Application Server V8.5 Concepts, Planning, and Design Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.