On Sat, Sep 3, 2011 at 7:57 AM, Craig Taylor <ctalk...@ctalkobt.net> wrote:
> I resolved this issue by dynamically creating a RouteBuilder,  then removing
> the route after a small period of time had passed (in my case, it should be
> safe to do).
>
> However, one of the other thoughts that had occurred to me afterwards is
> that camel may be maintaining a list of exchanges internally that have yet
> to be considered "complete".  If I had used a producer template to send the
> returned exchange to, a eg: "log:blah" would the delete processing of the
> file endpoint have occurred?
>

Its the file/ftp consumer which executes the delete when the routing is done.
So it doesn't matter how long the route is, if there is one, two, ...
ten EIPs in the route.

Camel has an in-flight registry which keeps track of number of current
in-flight exchanges.
You can take a look into that.


>
> On Fri, Sep 2, 2011 at 3: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.
>>
>> This is in Camel 2.2 btw (I know... I know... )
>>
>> Thanks,
>>
>> --
>> -------------------------------------------
>> Craig Taylor
>> ctalk...@ctalkobt.net
>>
>>
>
>
> --
> -------------------------------------------
> 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/

Reply via email to