On Sun, Feb 21, 2010 at 4:17 PM, watcher <[email protected]> wrote:
>
> <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.
>

You cannot propagate headers when using pollEnrich. You have to set
the filename you want to poll on the FTP endpoint URI.
This is not what you want to do, so you can use a Processor to poll
the FTP file using Java code which allows you to current Exchange when
polling.

> 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.
>
>



-- 
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

Reply via email to