camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Taylor <ctalk...@ctalkobt.net>
Subject Camel 2.2 Removal of Endpoint Files
Date Fri, 02 Sep 2011 19:34:26 GMT
>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
ctalkobt@ctalkobt.net

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message