added rmi.xml

This commit is contained in:
Iwein Fuld
2008-10-14 19:55:48 +00:00
parent 3fe03c9020
commit 9c402f9059
3 changed files with 75 additions and 27 deletions

View File

@@ -13,33 +13,23 @@
There is a namespace that enables elements that define channel
adapters dedicated to files and support for transformers that
transform files into strings or byte arrays.
</para>
</para>
<para>
This section will explain the workings of<classname>PollableFileSource</classname>,
<classname>FileWritingMessageConsumer</classname> and how to configure them as
<emphasis>beans</emphasis>. Also the support for dealing with files through file specific
implementations of <interfacename>Transformer</interfacename> will be discussed. Finally
the file specific namespace will be explained.
This section will explain the workings of <classname>PollableFileSource</classname>, <classname>FileWritingMessageConsumer</classname> and how to configure them as <emphasis>beans</emphasis>. Also the support for dealing with files through file specific implementations of <interfacename>Transformer</interfacename> will be discussed. Finally the file specific namespace will be explained.
</para>
</section>
<section id="file-reading">
<title>Reading Files</title>
<para>
A
<classname>PollableFileSource</classname>
can be used to consume files from the filesystem. This is an
implementation of
<interfacename>PollableSource</interfacename>
that creates messages from a file system directory.
A <classname>PollableFileSource</classname> can be used to consume files from the filesystem. This is an implementation of <interfacename>PollableSource</interfacename> that creates messages from a file system directory.
<programlisting language="xml"><![CDATA[<bean id="pollableFileSource" class="org.springframework.integration.file.PollableFileSource"
p:inputDirectory="file:${input.directory.property}"/>]]></programlisting>
</para>
<para>
To prevent creating messages for certain files, you may supply a
{@link FileListFilter}. By default, an
<classname>AcceptOnceFileListFilter
</classname>
<classname>AcceptOnceFileListFilter</classname>
is used. This filter ensures files are picked up only once from the
directory.
<programlisting language="xml"><![CDATA[<bean id="pollableFileSource" class="org.springframework.integration.file.PollableFileSource"
@@ -90,16 +80,14 @@
</beans>]]></programlisting>
Within this namespace you can reduce the PollableFileSource and wrap
it in a InboundChannelAdapter like this:
<programlisting language="xml"><![CDATA[ <file:inbound-channel-adapter id="filesIn"
directory="file:${input.directory.property}"/> (1)
<file:inbound-channel-adapter id="filesIn"
directory="file:${input.directory.property}"
filter="customFilterBean" /> (2)
<file:inbound-channel-adapter id="filesIn"
directory="file:${input.directory.property}"
filename-pattern="^test.*$" /> (3)
]]>
</programlisting>
<programlisting language="xml"><![CDATA[<file:inbound-channel-adapter id="filesIn"
directory="file:${input.directory.property}"/> (1)
<file:inbound-channel-adapter id="filesIn"
directory="file:${input.directory.property}"
filter="customFilterBean" /> (2)
<file:inbound-channel-adapter id="filesIn"
directory="file:${input.directory.property}"
filename-pattern="^test.*$" /> (3)]]></programlisting>
Where (1) is relying on the default filter that just prevents
duplication, (2) is using a custom filter and (3) is using the
<emphasis>filename-pattern</emphasis>
@@ -133,8 +121,7 @@
To make things easier you can configure the
FileWritingMessageConsumer as part of an outbound channel adapter
using the namespace.
<programlisting language="xml"><![CDATA[ <file:outbound-channel-adapter id="filesOut" directory="file:${input.directory.property}"/>
]]></programlisting>
<programlisting language="xml"><![CDATA[ <file:outbound-channel-adapter id="filesOut" directory="file:${input.directory.property}"/>]]></programlisting>
</para>
<para>
If you have more elaborate requirements to the payload to file
@@ -177,7 +164,7 @@
<para>
To configure File specific transformers you can use the appropriate
elements from the file namespace.
<programlisting language="xml"><![CDATA[ <file-to-bytes-transformer input-channel="intput" output-channel="output" delete-files="true"/>]]></programlisting>
<programlisting language="xml"><![CDATA[<file-to-bytes-transformer input-channel="intput" output-channel="output" delete-files="true"/>]]></programlisting>
The
<emphasis>delete-files</emphasis>
option signals the transformer to delete the File after the

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="resources">
<title>RMI</title>
<section id="rmi-intro">
<title>Introduction</title>
<para>
This Chapter explains how to use RMI specific channel adapters to distribute a system over multiple jvm's. The first section will deal with sending messages over RMI. The second section shows how to receive messages over RMI. The last section shows how to define rmi channel adapters through the namespace support
</para>
</section>
<section id="rmi-outbound">
<title>Outbound RMI</title>
<para>
To send messages from a channel over RMI, simply define an <classname>RmiOutboundGateway</classname>. This gateway will use Spring's RmiProxyFactoryBean internally to create a proxy for a remote gateway. Note that to invoke a remote interface that doesn't use Spring Integration you should use a service activator in combination with Spring's RmiProxyFactoryBean.
</para>
<para>
To configure the outbound gateway write a bean definition like this:
<programlisting language="xml"><![CDATA[ <bean id="rmiOutGateway" class=org.spf.integration.rmi.RmiOutboundGateway>
<constructor-arg value="rmi://host"/>
<property name="replyChannel" value="replies"/>
</bean>]]>
</programlisting>
</para>
</section>
<section id="rmi-inbound">
<title>Inbound RMI</title>
<para>
To receive messages over RMI you need to use a <classname>RmiInboundGateway</classname>. This gateway can be configured like this
<programlisting language="xml"><![CDATA[ <bean id="rmiOutGateway" class=org.spf.integration.rmi.RmiInboundGateway>
<property name="requestChannel" value="requests"/>
</bean>]]>
</programlisting>
</para>
</section>
<section id="rmi-namespace">
<title>RMI namespace support</title>
<para>
To configure the inbound gateway you can choose to use the namespace support for it. The following code snippet shows the different configuration options that are supported.
<programlisting language="xml"><![CDATA[ <rmi:inbound-gateway id="gatewayWithDefaults" request-channel="testChannel"/>
<rmi:inbound-gateway id="gatewayWithCustomProperties" request-channel="testChannel"
expect-reply="false" request-timeout="123" reply-timeout="456"/>
<rmi:inbound-gateway id="gatewayWithHost" request-channel="testChannel" registry-host="localhost"/>
<rmi:inbound-gateway id="gatewayWithPort" request-channel="testChannel" registry-port="1234"/>
<rmi:inbound-gateway id="gatewayWithExecutorRef" request-channel="testChannel" remote-invocation-executor="invocationExecutor"/>]]></programlisting>
</para>
<para>
To configure the outbound gateway you can use the namespace support as well. The following code snippet shows the different configuration for an outbound rmi gateway.
<programlisting language="xml"><![CDATA[ <rmi:outbound-gateway id="gateway" request-channel="localChannel" remote-channel="testChannel" host="localhost"/>]]></programlisting>
</para>
</section>
</chapter>

View File

@@ -36,6 +36,7 @@
<xi:include href="./core-api.xml"/>
<xi:include href="./adapters.xml"/>
<xi:include href="./file.xml"/>
<xi:include href="./rmi.xml"/>
<xi:include href="./configuration.xml"/>
<xi:include href="./samples.xml"/>
<xi:include href="./resources.xml"/>