polish doc

This commit is contained in:
Mark Fisher
2010-12-16 15:12:55 -05:00
parent f7beff8d11
commit 40f652e60f

View File

@@ -163,34 +163,37 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp
]]></programlisting>
</para>
<para>
<emphasis>Poller configuration notes for FTP Inbound adapter</emphasis>
<emphasis>Poller configuration notes for the inbound FTP adapter</emphasis>
</para>
<para>
The job of protocol specific adapters such as FTP consists of two tasks.
<emphasis>1) Communicate with remote server and transfer file from the remote directory to the local directory</emphasis>
<emphasis>2) Generate Message with the transferred file as a payload and send it to a channel identified via 'channel' attribute.</emphasis>
The job of the inbound FTP adapter consists of two tasks:
<emphasis>1) Communicate with a remote server in order to transfer files from a remote directory to a local directory.</emphasis>
<emphasis>2) For each transferred file, generate a Message with that file as a payload and send it to the channel identified by the 'channel' attribute.</emphasis>
That is why they called 'channel-adapters' not just 'adapters' and therefore the main job of such adapter is to generate a
Message which essentially makes the second part of the above explanation to take precedence in such way that
*IF* your local directory already has a file(s) it will first generate Messages from these files and *ONLY*
when all files have been processed it will initiate the remote communication to get more files.
So when configuring a trigger on the poller you might want to pay an extra attention to <code>max-messages-per-poll</code>
attribute which has a default value of 1 for all <classname>SourcePollingChannelAdapter</classname> instances (e.g., FTP).
This means that as soon as one file is processed it will wait for the next execution time which is dependent on your
trigger configuration, so if you happened to have a file(s) sitting in the <code>local-directory</code> it would process
those files before it would initiate communication with remote FTP server and if the <code>max-messages-per-poll</code>
was set to 1 (default) then it would be processing one file at the time with intervals defined by your trigger
That is why they are called 'channel-adapters' rather than just 'adapters'. The main job of such an adapter is to generate a
Message to be sent to a Message Channel. Essentially, the second task mentioned above takes precedence in such a way that
*IF* your local directory already has one or more files it will first generate Messages from those, and *ONLY*
when all local files have been processed, will it initiate the remote communication to retrieve more files.
</para>
<para>
Also, when configuring a trigger on the poller you should pay close attention to the <code>max-messages-per-poll</code>
attribute. Its default value is 1 for all <classname>SourcePollingChannelAdapter</classname> instances (including FTP).
This means that as soon as one file is processed, it will wait for the next execution time as determined by your
trigger configuration. If you happened to have one or more files sitting in the <code>local-directory</code>, it would process
those files before it would initiate communication with the remote FTP server. And, if the <code>max-messages-per-poll</code>
were set to 1 (default), then it would be processing only one file at a time with intervals as defined by your trigger,
essentially working as <emphasis>one-poll = one-file</emphasis>.
</para>
<para>
For typical use cases you most likely want the oposite behavior and that is to process all the files you can for each
poll and only then wait for the next poll. If that is the case it is recommended to set <code>max-messages-per-poll</code> to -1
value which means on each poll the adapter will attempt to generate as many messages as it possibly can meaning it will process
everything in the local directory, then it will connect to the remote directory transferring everything that is available
there and processing them locally. Only then the poll will stop and wait for the next execution time
You can also set it to some value greater then 1 (e.g., 10 which means on each poll attempt to process no more then 10 files)
For typical file-transfer use cases, you most likely want the opposite behavior: to process all the files you can for each
poll and only then wait for the next poll. If that is the case, set <code>max-messages-per-poll</code> to -1. Then, on
each poll, the adapter will attempt to generate as many Messages as it possibly can. In other words, it will process
everything in the local directory, and then it will connect to the remote directory to transfer everything that is available
there to be processed locally. Only then is the poll operation considered complete, and the poller will wait for the next execution time.
</para>
<para>
You can alternatively set the 'max-messages-per-poll' value to a positive value indicating the upward limit of Messages to be created
from files with each poll. For example, a value of 10 means that on each poll it will attempt to process no more than 10 files.
</para>
</section>