camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Camel FTP/SFTP check instead of download
Date Wed, 30 May 2012 07:20:50 GMT
On Fri, May 25, 2012 at 7:52 PM, Nestor Urquiza
<> wrote:
> Thanks Clous. Your answers brought me back to earth.
> I think I missed the point about what the ftp components and any other Camel
> component is about (Producer/Consumer). I was trying to activate a route
> from a seda component and then only at that point try to test for the
> existence of a file in the remote SFTP. If that is what I need I should use
> just a bean and not really the component. If the need is to constantly check
> for the file existence then we just use the Polling Consumer pattern.
> My needs (send an email when there is a new file) could be covered (tested
> and it works) with a filter like below:
> <code>
>        public class FileAttributesFilter<T> implements GenericFileFilter<T>
>        public boolean accept(GenericFile<T> file) {
>            return file.getLastModified() + RECONNECT_DELAY_MSEC >
> System.currentTimeMillis();
>        }
>    }
> </code>
> However the next question is how to make sure two JVMs running the same
> Camel routes do not compete with each other. If I use a persisted quartz
> route and a bean I can be sure that only one one JVM will run the quartz
> StatefulJob which can produce the message for a unique end point in that VM.
> How can I achieve the same with the Camel FTP Consumer?

You can for example use a route policy and figure out the locking
strategy yourself.

Maybe tie that into quartz clustering support somehow.

The Fuse Fabric has a Camel master component that does a master/slave
for Camel routes in a cluster.

Does not updated yet

That requires to use Fabric though, in eg Apache Karaf / ServiceMix or
the Fuse products/

> Also it looks like Camel FTP pulls the files even when using
> fastExistsCheck=true, is that expected? I know it does pull the file because
> if I chain an smtp component I get the content of the file by email.

Yeah it always download the file. We could possible add option
download=true|false, to the ftp component.
Then ppl can use download=false, to be notified of the existence of new files.
Fell free to create a JIRA for that idea.

> On my initial tests (for the record) there were several miss understanding
> generating all errors I posted:
> 1. As it implements the Polling Consumer Pattern Camel FTP will continue to
> poll, you can control the delay and other parameters but that won't mean it
> will stop retrying even if the problem is related to bad credentials.
> 2. After providing a username any path after the domain is relative to the
> home directory so should you need absolute paths you need to add a slash so
> "s" is really equivalent to just
> "s" (most of the time)
> 3. FTP2 inherits all fields from File2 between which there is an option to
> pull just one file. Implementing a GenericFileFilter is an alternative that
> goes beyond that as you can literally check for any file attributes before
> accepting the file as a valid message for the route.
> Best,
> -Nestor
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message