I'm looking to archive file(s) which are triggered by an jms message.
However it seems to ignore the file option "delete=true" and the file is not
deleted after it is consumed.

<code>
from("activemq:queue:fileArchive").process(new Processor() {
                        public void process(final Exchange exchange) throws 
Exception {

                                // Get Header properties
                                Message message = (Message) exchange.getIn();
                                final String filename = (String) 
message.getHeader("filename");
                                
                                // Create file url for polling
                                String url =
"file://c://fileserver?delete=true&readLock=rename&fileName=" + filename;
                                log.info(url);
                                
                                Endpoint endpoint = 
getContext().getEndpoint(url);
                                
                                PollingConsumer consumer = 
endpoint.createPollingConsumer();
                                consumer.start();
                                Exchange pollExchange = consumer.receive();
                                consumer.stop();
                                
exchange.getOut().setBody(pollExchange.getIn().getBody());
                                exchange.getOut().setHeader(Exchange.FILE_NAME, 
filename);
                                
                        }
                  }).to("file://c://archive");
</code>

I've also tried implementing the pollEnrich with a similar issue.

from("activemq:queue:fileArchive")
                .setHeader(Exchange.FILE_NAME, header("filename"))
                  
.pollEnrich("file://c://fileserver?delete=true&readLock=rename&fileName=" +
header("fileName")).to("file://c://archive");

Camel version 2.1.0
WIndows XP

Any ideas?
-- 
View this message in context: 
http://old.nabble.com/Polling-consumer-not-deleting-file-tp27499343p27499343.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to