Hi,

Having multiple consumers fetch files from the same directory
concurrently is dangerous.

How do you guarantee they don't step on each other's toes and end up
picking up the same files? You would need some kind of atomic locking
mechanism so you could lock a file as soon as you start processing it,
all in one operation. FTP doesn't have this capability.

However, you can achieve a higher level of concurrency by making the
remainder of your route asynchronous.

Insert the threads() processor just after the from("ftp:..."), OR send
to a SEDA endpoint where the SEDA consumer has the
"concurrentConsumers" option set to the desired level of concurrency.

There are more ways, but those two are the most common.

Thanks,
Raul.

On 27 Apr 2012, at 10:44, Stefan Burkard <[email protected]> wrote:

> See this page: http://camel.apache.org/ftp2.html
>
> ==> FTP Consumer does not support concurrency
> The FTP consumer (with the same endpoint) does not support concurrency
> (the backing FTP client is not thread safe).
> You can use multiple FTP consumers to poll from different endpoints.
> It is only a single endpoint that does not support concurrent
> consumers.
>
>
>
> On Fri, Apr 27, 2012 at 05:55, Deepthi <[email protected]> wrote:
>> Hi,
>>
>> I am trying to read files from 1 server through FTP, process the files and
>> FTP it to another server.
>> How can i achieve multi-threading within a route.
>>
>> If i have 50 files in the source server, I want 50 threads to be running
>> simultaneously, read the files and process all the files simultaneously, one
>> file in each thread.
>>
>> How can i achieve this?
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/How-to-achieve-multi-threading-within-a-route-tp5669200p5669200.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to