servicemix - Camel PollingConsumer - Deleting orphaned lock file, but original file is not deleted -


i have simple route getting files ending in .fin have body name of file have send ftp server. route:

<route id="sendtoftp">     <from uri="file:{{tmp.files.location}}/export/pr?delete=true&amp;include=.*.txt.fin"/>     <process ref="getfileprocess" />     <log message="sending message ${file:name}"/>     <setheader headername="camelfilename">         <simple>${file:name.noext}</simple>     </setheader>     <delay>         <constant>10000</constant>     </delay>     <to uri="{{export.feed.ftp}}{{export.feed.ftp.folder}}?username={{export.feed.ftp.username}}&amp;password={{export.feed.ftp.password}}&amp;passivemode=true&amp;connecttimeout={{feed.interval}}&amp;timeout={{feed.interval}}&amp;sotimeout={{feed.interval}}&amp;disconnect=true" /> </route> 

i'm using polling consumer in file in order retrieve local file send ftp. here process:

@override public void process(exchange exchange) throws exception {     final string filename = exchange.getin().getbody(string.class);      endpoint endpoint = exchange.getcontext().getendpoint("file:{{powerreviews.tmp.files.location}}/export/pr?delete=true&filename="+filename);      pollingconsumer consumer = endpoint.createpollingconsumer();      consumer.start();     exchange ex = consumer.receive(60000);      if (ex==null){         exchange.getin().setbody("");     }else {         exchange.getin().setbody(ex.getin().getbody());     }     consumer.stop(); } 

when execute route seems exchanges not closed after end of route cause files .fin , 1 consume pollingconsume not deleted, when explicitly have in endpoint delete=true parameter. anyway file correctly sent ftp.

in log have following:

2014-06-27 20:23:03,765 | warn  | roduct/export/pr | kerfileexclusivereadlockstrategy | 100 - org.apache.camel.camel-core - 2.10.7 | deleting orphaned lock file: tmp/product/export/pr/the.txt.fin.camellock 2014-06-27 20:28:08,041 | warn  | roduct/export/pr | kerfileexclusivereadlockstrategy | 100 - org.apache.camel.camel-core - 2.10.7 | deleting orphaned lock file: tmp/product/export/pr/the.txt.camellock 

the file not deleted because oncompletion on exchange ex consumer template returned not executed. javadoc documentation documents in more details.

but want delete filter later, can upload ftp server first, need handover oncompletions exchange ex exchange exchange, add code @ end of method

    }     consumer.stop();      // handover me incoming exchange     // delete file @ end of route     ex.handovercompletions(exchange); } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -