The additional configuration consists of adding the following nine new beans to the geocodeJob.xml
chunkHandler : This is a factory bean used to create the ChunkHandler that
replaces the ItemProcessor in the step in question. It also does the replacement
chunkWriter : This bean is a special writer used to send items out to the listening
slave nodes for processing. It also listens for the responses and takes them off the
inbound queue for the ItemWriter to complete processing.
messageGateway : This is the MessagingTemplate from Spring Integration that the
chunkWriter uses to do the JMS calls.
requests and incoming : These are the incoming and outgoing message channels
for the chunkWriter.
A JMS outbound channel adapter : This bean adapts your Spring Integration
channel to the physical outbound request's JMS queue.
headerExtractor : Because Spring Integration channels are in-memory concepts,
you run the risk of losing messages if one of the end points goes down. Spring
Integration addresses this by implementing a redelivery system. This header
extractor extracts the related header and sets it on the
org.springframework.batch.integration.chunk.ChunkResponse so that your job
knows whether this was the original response.
• replies : This is the Spring Integration channel used to send the processed item
back from the slave node to the master job.
• listenerContainer : This is the definition of the message listener that acts as the
slave elements and processes each of the messages sent out by the master job.
As you can see, this example includes a number of moving parts. Although it looks like a long list,
the configuration isn't that bad. Listing 11-27 shows the configuration for geocodingJob .
Listing 11-27. gecodingJob Configured with Remote Chunking
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns=" http://www.springframework.org/schema/batch"