FTP routing in Apache camel framework

Source: Internet
Author: User
Tags filezilla apache camel

This is often the case when you are working on projects of the Project Integration type. users or other systems upload files to an FTP server, and then the system retrieves files from the FTP server for corresponding processing.

This article briefly introduces and provides an example of a requirement to use camel to monitor whether ftpserver has files and transfer the obtained files to another system for processing (the image is from camel in action)

1, build an FTP server, download filezilla installation from the http://sourceforge.net/projects/filezilla/files/, set up a user Yorker/123456.

You can refer to this URL http://xbeta.info/filezilla-server.htm

2. implement routing in camel:

        CamelContext context = new DefaultCamelContext();        context.addRoutes(new RouteBuilder() {            public void configure() {                                          from("ftp://localhost/inbox?username=yorker&password=123456").to(                "file:d:/temp/outbox");            }        });        context.start();        boolean loop = true;        while (loop) {            Thread.sleep(25000);        }        context.stop();

Here is mainly for example camel's support for FTP, without the processing of processor. downstream system is just used as an example to put it in a local folder. however, when a project is actually implemented, it can be of another type in to, such as the queue of JMS, The Ftb inbound folder of other systems, and Web Service. if you write the URI from above to, it is uploaded to the FTP folder.

In addition to the jar package used by camel, you also need a http://commons.apache.org/net/download_net.cgi to download the commons-net.jar

See the http://blog.csdn.net/kkdelta/article/details/7231640 for how to add processor processing in the middle of the process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.