You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by tonyhe <mr...@gmail.com> on 2010/10/09 23:33:24 UTC

disconnect=true is not working for Camel-FTP file download

Hi,
I wanted to use Camel-FTP (v2.4) to download a file to a directory.

Here I set up my routes:

from("ftp://www.ibiblio.org/pub/mirrors/apache/camel/apache-camel/2.4.0/?filter=#camelFileFilter&disconnect=true")
    .to("file:target/messages/others");


My camelFileFilter class
public class CamelFileFilter implements GenericFileFilter
{
        final static Logger logger =
Logger.getLogger(CamelFileFilter.class);
       
    public boolean accept(GenericFile file)
    {
    logger.debug("fileName=" + file.getFileName());
        return file.getFileName().equals("apache-camel-2.4.0.zip.asc");    
    }
}

I want this route to stop immediately when the "apache-camel-2.4.0.zip.asc"
file has been downloaded. But it seems after Camel-FTP successfully
downloads my file, it is ignoring my "disconnect=true" property and just
keeps
displaying:
FtpConsumer                    INFO  Connected and logged in to:
ftp://anonymous@www.ibiblio.org:21
FtpConsumer                    INFO  Connected and logged in to:
ftp://anonymous@www.ibiblio.org:21
and never terminate the program.

Has anyone else encountered this problem?
-- 
View this message in context: http://camel.465427.n5.nabble.com/disconnect-true-is-not-working-for-Camel-FTP-file-download-tp3206046p3206046.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: disconnect=true is not working for Camel-FTP file download

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Disconnect=true is to only re-use the old connection on the next poll.

If you only want to poll the file one time, then you need to stop the
route afterwards.
You can use the API from CamelContext to stop a route.

Also Camel in Action chapter 13 which explains and shows you how to do this.


On Sat, Oct 9, 2010 at 11:33 PM, tonyhe <mr...@gmail.com> wrote:
>
> Hi,
> I wanted to use Camel-FTP (v2.4) to download a file to a directory.
>
> Here I set up my routes:
>
> from("ftp://www.ibiblio.org/pub/mirrors/apache/camel/apache-camel/2.4.0/?filter=#camelFileFilter&disconnect=true")
>    .to("file:target/messages/others");
>
>
> My camelFileFilter class
> public class CamelFileFilter implements GenericFileFilter
> {
>        final static Logger logger =
> Logger.getLogger(CamelFileFilter.class);
>
>    public boolean accept(GenericFile file)
>    {
>    logger.debug("fileName=" + file.getFileName());
>        return file.getFileName().equals("apache-camel-2.4.0.zip.asc");
>    }
> }
>
> I want this route to stop immediately when the "apache-camel-2.4.0.zip.asc"
> file has been downloaded. But it seems after Camel-FTP successfully
> downloads my file, it is ignoring my "disconnect=true" property and just
> keeps
> displaying:
> FtpConsumer                    INFO  Connected and logged in to:
> ftp://anonymous@www.ibiblio.org:21
> FtpConsumer                    INFO  Connected and logged in to:
> ftp://anonymous@www.ibiblio.org:21
> and never terminate the program.
>
> Has anyone else encountered this problem?
> --
> View this message in context: http://camel.465427.n5.nabble.com/disconnect-true-is-not-working-for-Camel-FTP-file-download-tp3206046p3206046.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: disconnect=true is not working for Camel-FTP file download

Posted by Willem Jiang <wi...@gmail.com>.
Can you try the latest Camel 2.5-SNAPSHOT? It fixed some camel-ftp 
components bug of Camel 2.4.0.

Maybe this thread[1] can give you some hit to workaround the issue.

[1]http://camel.465427.n5.nabble.com/anonymous-FTP-login-fails-td2846235.html#a2846235

10/10/10 5:33 AM, tonyhe wrote:
>
> Hi,
> I wanted to use Camel-FTP (v2.4) to download a file to a directory.
>
> Here I set up my routes:
>
> from("ftp://www.ibiblio.org/pub/mirrors/apache/camel/apache-camel/2.4.0/?filter=#camelFileFilter&disconnect=true")
>      .to("file:target/messages/others");
>
>
> My camelFileFilter class
> public class CamelFileFilter implements GenericFileFilter
> {
>          final static Logger logger =
> Logger.getLogger(CamelFileFilter.class);
>
>      public boolean accept(GenericFile file)
>      {
>      logger.debug("fileName=" + file.getFileName());
>          return file.getFileName().equals("apache-camel-2.4.0.zip.asc");
>      }
> }
>
> I want this route to stop immediately when the "apache-camel-2.4.0.zip.asc"
> file has been downloaded. But it seems after Camel-FTP successfully
> downloads my file, it is ignoring my "disconnect=true" property and just
> keeps
> displaying:
> FtpConsumer                    INFO  Connected and logged in to:
> ftp://anonymous@www.ibiblio.org:21
> FtpConsumer                    INFO  Connected and logged in to:
> ftp://anonymous@www.ibiblio.org:21
> and never terminate the program.
>
> Has anyone else encountered this problem?


-- 
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang