Java Reference
In-Depth Information
The additional configuration consists of adding the following nine new beans to the geocodeJob.xml
file:
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
for you.
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"
xmlns:beans=" http://www.springframework.org/schema/beans"
xmlns:int-jms=" http://www.springframework.org/schema/integration/jms"
xmlns:int=" http://www.springframework.org/schema/integration"
xmlns:jms=" http://www.springframework.org/schema/jms"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/integration/jms
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/jms
http://www.springframework.org/schema/jms/spring-jms-3.0.xsd
http://www.springframework.org/schema/batch
 
Search WWH ::




Custom Search