Java Reference
In-Depth Information
Let's revisit the first solution, but this time with a file-based adapter. The configuration looks
conceptually the same as before, except the configuration for the adapter has changed, and with that has
gone a lot of the configuration for the JMS adapter, like the connection factory. Instead, you tell Spring
Integration about a different source from whence messages will come: the file system.
<?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 time-unit="SECONDS" interval="10"/>
</poller>
<beans:bean id="inboundHelloWorldFileMessageProcessor"
class="com.apress.springenterpriserecipes.springintegration.
➥
InboundHelloWorldFileMessageProcessor"/>
<channel id="inboundFileChannel"/>
<file:inbound-channel-adapter directory="${user.home}/inboundFiles/new/"
channel="inboundFileChannel"
filename-pattern="^new.*csv"
/>
<service-activator input-channel="inboundFileChannel"
➥
ref="inboundHelloWorldFileMessageProcessor"/>
</beans:beans>
Nothing you haven't already seen, really. The code for
file:inbound-channel-adapter
is the only
new element, and it comes with its own schema, which is in the prologue for the XML itself.
The code for the
service-activator
has changed to reflect the fact that you're expecting a message
containing a message of type
Message<java.io.File>
.
Search WWH ::
Custom Search