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?

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.

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
"sftp://sample.com//home/admin?username=admin"; is really equivalent to just
"sftp://sample.com?username=admin"; (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: 
http://camel.465427.n5.nabble.com/Camel-FTP-SFTP-check-instead-of-download-tp5713363p5713567.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to