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:context="
http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
➥
➥
<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