This article demonstrates how to define a simple job (JSR 352) using the j
Batch Suite in NetBeans IDE and how to implement the corresponding batch artifacts.
- Transition - Next
Batch processing is execution of series of "jobs" that is suitable for non-interactive, bulk-oriented and long-running tasks.Typical examples are end-of-month bank statement generation, end-of-day jobs such as interest calculation, and ETL (extract-transform-load) in a data warehouse.
JSR - 352
JSR 352 defines a Job Specification Language (JSL) to define batch jobs, a set of interfaces that describes the artifacts that comprise the batch programming model to implement batch business logic . Using jBatch Suite developer may design JSL and generate Job file & source code (batch artifatcs ) .
A Job is an instance that encapsulates an entire batch process.A job is typically put together using a Job Specification Language and consists of multiple steps. The Job Specification Language for JSR 352 is implemented with XML and is referred as "Job XML".
With JSR 352, a Job is simply a container for Steps. It combines multiple steps that belong logically together in a flow .
Each step may be either a chunk type step or batchlet type step.
The batchlet element specifies a task-oriented batch step.
It is mutually exclusive with the chunk element.
Steps of this type are useful for performing a variety of tasks that are not item-oriented, such as executing a command or doing file transfer.
Test your first Job file
The batch job is not automatically started when the application is deployed. A batch job must be initiated explicitly, say, from a servlet or from an Enterprise JavaBeans (EJB) timer or an EJB business method.
JobOperator provides an interface to manage all aspects of job processing, including operational commands, such as start, restart, and stop, as well as job repository commands, such as retrieval of job and step executions.
BatchRuntime.getJobOperator().start("myJob", new Properties());
The batch runtime loads the batch artifacts you specify in your JSL and runs the job on a separate thread.
All steps in your job run on the same thread unless you are using partitions or splits.
A decision provides a customized way of determining sequencing among steps, flows, and splits.
A decision batch artifact decide the next transition. The decision uses any of the transition elements, stop, fail, end, and next elements to select the next transition.
The next element is used to transition the current decision to the next execution element. Multiple next elements may be specified in the current containment scope.
A flow defines a sequence of execution elements(step, flow, decision, and split) that execute together as a unit.
When the flow is finished, it is the entire flow that transitions to the next execution element.
A flow may transition to a step, split, decision, or another flow.