Java Reference
In-Depth Information
<beans:bean id="jobRepository"
p:transactionManager-ref="transactionManager" p:dataSource-ref="dataSource" />
The job repository is the central piece of the safety net that Spring Batch provides for your
processing. However, it's much more than just a tool for the Spring Batch framework's own use. You
have as much access to the data as the framework does, along with the ability to manipulate that data.
This next section shows you how how.
Using Job Metadata
Although Spring Batch accesses the job repository tables through a collection of DAOs, they expose a
much more practical API for the use of the framework and for you to use. This section you look at the
two ways Spring Batch exposes the data in the job repository. First you look at the JobExplorer, an item
you configured last chapter, how to configure it and read data from the repository using it. From there
you move onto the JobOperator. You look at how to configure the operator as well as use it to
manipulate the data contained in the job repository. Let's start with the JobExplorer.
The JobExplorer
The org.springframework.batch.core.explore. JobExplorer interface is the starting point for all access to
historical and active data in the job repository. Figure 5-1 shows that although most of the framework
accesses the information stored about job execution through the JobRepository, the JobExplorer
accesses it directly from the database itself.
calls to start/stop/restart a job
calls to update a job's status
obtains job metadata and state from
calls to get job information
calls to obtain job information
Figure 5-1. The relationship between the job administration components
The underlying purpose of the JobExplorer is to provide read-only access to the data in the job
repository. The interface provides seven methods you can use to obtain information about job instances
and executions. Table 5-1 lists the available methods and their use.
Search WWH ::

Custom Search