camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <>
Subject Re: Camel 2.3.0 - File Endpoint with delete=true and moveFailed doesn't move failed files
Date Wed, 30 Jun 2010 03:17:40 GMT

I just checked the code of Camel File component, you can't specify the 
delete and move (moveFailed) option at the same time, as current Camel 
file component didn't support these two strategy at same time.

I think you can do some work around by using onException() with the 
delete option, like this :

from("file://target/failed?delete=true") ....

Apache Camel, Apache CXF committer
Open SOA

jonathanq wrote:
> I am using Camel 2.3.0 - I have a file endpoint that is configured with
> delete=true and moveFailed=error.  Yet when an error occurs, it does not
> move it to a failed directory, and instead keeps re-trying the exchange.
> Here is a route that shows my setup:
> public void configure() throws Exception {
> onException().process(myErrorProcessor).to("mock:error");
> from("file://c:\\input?delete=true&moveFailed=error").process(someProcessor).unmarshal().xstream().to("mock:result")
> }
> The processor just does a simple transformation - however I am feeding it
> invalid XML so that the unmarshal will fail.  The error processor is
> executed, but when it completes and sends its error message to "mock:error"
> - the whole route starts again.
> I removed the "delete=true" so it was just:
> "file://c:\\input?moveFailed=error".  Then when an error occurs, it moves
> the file to error subdirectory.  And the completed files go to ".camel".
> I don't want to have to remove the completed files manually so I changed the
> route to:
> "file://c:\\input?delete=true"
> Now - regardless of whether an exception occurs - the input file is deleted.
> It seems to be that the combination of both "delete=true" and
> "moveFailed=error" seems to cause the route to keep re-trying indefinately,
> but on their own - they work exactly as advertised.
> Is the delete=true supposed to only moved completed (successfully) files? 
> The documentation only says it will delete them after they are processed
> (doesn't say if they succeeded or not).
> I added a handled(true) on my exception route - and then it just deletes the
> file and never moves it to the error folder.
> I can remove the delete=true and my process will do what I want - however
> then I have to make a manual step later to delete the contents of the .camel
> folder for the ones that did work.  And I don't want to do that, seems to me
> the delete=true should handle that.
> Jonathan 

View raw message