On Fri, Sep 2, 2011 at 9:34 PM, Craig Taylor <ctalk...@ctalkobt.net> wrote: > From a file based endpoint (eg: file, ftp, sftp) uri I'm attempting to > remove files via the following: > > public void removeFilesFromUri( ConsumerTemplate consumerTempl, CamelContext > camlContext, String uri ) > { > uri = uri + "&delete=true"; > > consumerTempl.start(); > > Exchange exc = consumerTempl.receive(uri,10000); > while( exc != null ) > { > System.err.println( "Deleting:" + > exc.getIn().getHeader(Exchange.FILE_NAME) ); > > // Receive and toss... > exc = consumerTempl.receive(uri,10000); > } > consumerTempl.stop(); > camlContext.removeEndpoints(uri); > } > > The files are not deleted. I am able to see the "Deleting: " println > entries for the affected endpoint files. I had expected that the act of > receiving an exchange would generate the deletion of them. > > Is there anything I need to do to indicate to camel that I'm finished with > the exchange and it's safe for it to remove the file? In other posts I've > seen references to : > exc.getUnitOfWork().done(exc) however, in the code above getUnitOfWork() > returns null. >
You would need Camel 2.7 or something like (cant remember the exact version) that to have this working with consumer templates. There is an API on ConsumerTemplate to execute the done on the exchange. > This is in Camel 2.2 btw (I know... I know... ) > > Thanks, > > -- > ------------------------------------------- > Craig Taylor > ctalk...@ctalkobt.net > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/