Java Reference
In-Depth Information
1. Write the Java for the job: This job requires only a small amount of code.
Specifically, you need to develop a domain object ( Customer ), a RowMapper
implementation to map the customer data you retrieve as input from the
database to your customer objects, an ItemProcessor to handle the web service
call, and a class with a main method (discussed later).
2. Configure the basic job: The use of remote chunking doesn't require any
change to the way you configure a job, so you should create a fully operational
job before adding remote chunking to it.
3. Update the POM file with integration dependencies: Because remote chunking
requires a couple of additional dependencies, you need to update your POM
file to include them.
4. Configure remote chunking: Finally you configure the job to have remote
workers to help process your customers.
Before you get to the code, let's review the data model for this example. The Customers table is the
same as the one used in various other examples in this topic. The only additions are the two new
columns for the longitude and latitude. Figure 11-17 shows the updated table format.
Figure 11-17. Customers table
With the data model defined, let's look at the Java code required. None of the code contains
anything specific to remote chunking, and that is by design. Adding remote chunking is something you
can do with no impact on the way your job is developed. The domain object for this project, Customer ,
contains all the fields you would expect; see Listing 11-20.
Listing 11-20. Customer.java
package com.apress.springbatch.chapter11.domain;
import java.io.Serializable;
public class Customer implements Serializable{
 
Search WWH ::




Custom Search