<camel:endpoint id="ftpRepository"
uri="ftp://[email protected]?password=pass&amp;binary=true"/>

from("activemq:queue:printers")
// set the filename in FILE_NAME header so Camel know the name of the remote
file to poll
.setHeader(Exchange.FILE_NAME, header("filename"))
.pollEnrich(ftpRepository.getEndpointUri())
.to("file://c://fileserver//output");

Here's my test.

public void testCamel() throws Exception {

                ProducerTemplate camelTemplate =
(ProducerTemplate)getApplicationContext().getBean("camelTemplate");
        Map<String, Object> headers = new HashMap<String, Object>();
        headers.put("filename", "AA11.txt");            
            camelTemplate.sendBodyAndHeaders("activemq:queue:printers",  null,
headers);
    }

If the fileserver contains 2 files 
00AA.txt
AA11.txt

The route will copy over the 00AA.txt file. It appears to copy the 1st file
or whatever file that is ordered alphabetically.

Apache Camel 2.2
Windows XP
-- 
View this message in context: 
http://old.nabble.com/Consuming-a-remote-FTP-server-triggered-by-a-route-%28Error%29-tp27676486p27676486.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to