Java Reference
In-Depth Information
Message , it forwards each result out on the output-channel of the splitter component. In a few cases,
Spring Integration ships with useful splitters that require no customization. One example is the splitter
provided to partition an XML payload along an XPath query, XPathMessageSplitter .
One example of a useful application of a splitter might be a text file with rows of data, each of
which must be processed. Your goal is to be able to submit each row to a service that will handle the
processing. What's required is a way to extract each row and forward each row as a new Message .
The configuration for such a solution looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans=" http://www.springframework.org/schema/beans"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xmlns=" http://www.springframework.org/schema/integration"
xmlns:context=" http://www.springframework.org/schema/context"
xmlns:jms=" http://www.springframework.org/schema/integration/jms"
xmlns:file=" http://www.springframework.org/schema/integration/file"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/
spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/
spring-context-3.0.xsd http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/
spring-integration-1.0.xsd
http://www.springframework.org/schema/integration/jms
http://www.springframework.org/schema/integration/jms/
spring-integration-jms-1.0.xsd
http://www.springframework.org/schema/integration/file
http://www.springframework.org/schema/integration/file/
spring-integration-file-1.0.xsd">
<context:annotation-config/>
<poller id="poller" default="true">
<interval-trigger interval="1000"/>
</poller>
<beans:bean id="fileSplitter"
class="com.apress.springenterpriserecipes.
springintegration.CustomerBatchFileSplitter"/>
<beans:bean id="customerDeletionServiceActivator"
class="com.apress.springenterpriserecipes.
springintegration.CustomerDeletionServiceActivator"/>
<channel id="customerBatchChannel"/>
<channel id="customerIdChannel"/>
<file:inbound-channel-adapter
directory="file:${user.home}/customerstoremove/new/"
channel="customerBatchChannel" filename-pattern="^new.*txt$"/>
<splitter input-channel="customerBatchChannel"
ref="fileSplitter" output-channel="customerIdChannel" />
Search WWH ::




Custom Search