On Thu, Jul 14, 2011 at 11:20 AM, divanmostert <divan.most...@c24.biz> wrote:
> Hi,
>
> We have recently upgraded to Camel 2.7 where File Endpoints can no longer
> specify file names as the source, only directories and then additionally
> setting the filename property.
>
> This works fine for when we are only load ing one file at a time, however,
> our application do transforms that require us to load multiple files, which
> could all be in the same directory. This of course causes Camel to throw an
> exception saying:
>
> org.apache.camel.FailedToStartRouteException: Failed to start route route19
> because of Multiple consumers for the same endpoint is not allowed:
> Endpoint[file:///...]
>
> Is there any way of getting around this?
>

Its generally bad practice to have concurrent consumers compete for
the same files.

Instead you can keep one route to pickup new files, but then use the
threads EIP to let other threads take over and process the files.
I wrote a blog about this 2+ years ago so you may be able to google/find that.

Basically something like

from(file)
   .threads(10)
   .to("bean:doSomething")

eg to have 10 concurrent threads process the picked up files.

See more at
http://camel.apache.org/async


>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Loading-multiple-files-from-the-same-directory-tp4585994p4585994.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to