public interface BatchJobStepInterface extends com.ibm.batch.api.BatchJobStepInterface
The BatchJobStepInterface describes the business methods that a Batch Job Step entity bean (Batch Step Bean) implements. These methods are callbacks that allow a Batch Execution Environment (BEE) to manage the Batch Step Bean. The business interface of a Batch Step Bean has to be the BatchJobStepLocalInterface class which extends the BatchJobStepInterface class. The home interface of the Batch Step Bean must be the BatchJobStepLocalHomeInterface class and the primary key class of a Batch Step Bean has to be the BatchJobStepKey class.
When the batch job is ready to be dispatched, the Batch Execution Environment (BEE) will lookup the Batch Step Bean home interface
of the first step specified in the job xJCL and will create an instance of the step bean. BEE will then call the setProperties method to make any properties
that were specified in the xJCL available to the step bean. Then the BEE will call the createJobStep. BEE will then keep on calling
processJobStep in a batch loop until the return code (look at
BatchConstants) of the processJobStep method
indicates that the step has finished. The processJobStep method should contain all the business logic for the batch step. The BEE
ensures that the processJobStep method invocations (batch loop) run under a global transaction; the lifecycle of the global transaction
is managed by the Checkpoint policy that is applied to this batch job. Any transactional work within the processJobStep method
should inherit the global transaction context that is provided by the BEE.
When the processJobStep method return code indicates that the step has finished processing, BEE will call the destroyJobStep.
The BEE will then continue to process the next Batch Job Step specified in the xJCL.
The batch job step bean is a local entity bean that will be called by the Batch Execution Environment.
|Modifier and Type||Method and Description|
createJobStep is called by the Batch Execution Environment before calling processJobStep.
destroyJobStep is called when the Batch Execution Environment has finished processing the job step.
Returns the properties specified in the xJCL for the batch job step.
processJobStep should contain all the business logic for the batch job step.
Called by the Batch Execution Environment to make the properties specified in the xJCL available to the batch job step
void setProperties(java.util.Properties properties)
properties- - the properties specified in xJCL are available in this Properties object.
int processJobStep() throws java.lang.Exception
processJobStep should contain all the business logic for the batch job step. It is called by the Batch Execution Environment
(BEE) in a batch loop. The return code of the processJobStep indicates to the BEE whether it should exit
the batch loop or not. These return codes are specified in the
BatchConstants api. For example, if processJobStep
returns with return code BatchConstants.STEP_CONTINUE, the BEE will not exit the batch loop and will
call processJobStep again in the next iteration of the batch loop; however, if the processJobStep returns with return code
BatchConstants.STEP_COMPLETE, the BEE will exit the batch loop and hence stop calling the processJobStep method.
The processJobStep method runs under a global transaction that is managed by the Batch Execution Environment (BEE). Hence, it is recommended to have a transaction policy of TX_REQUIRED. The Checkpoint policy that is applied to the batch job (via xJCL) determines when the BEE should commit the global transaction. It is the responsibility of the Batch Step Bean author to ensure that any transaction sensitive calls made in the processJobStep method, (e.g. a call to another entity EJB) should inherit the global transaction under which processJobStep runs.
TODO: make BatchApplicationException part of api.