camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: File component - infinite consume on failure
Date Thu, 13 Jan 2011 14:03:02 GMT
On Tue, Jan 11, 2011 at 3:24 PM,  <> wrote:
> Hello Everyone,
>  I am having a problem using the file component's "inifinite consume on
> failure" feature.
>     Here is what I want to do in the route:
>     1) from("file:input?delete=true")
>     2) validation step
>     3) processing step
>     3) put the transformed in a queue and finish
>     4) if there is an error on the processing step, try 3 times, if still
> failing move the file to a failedProcessing folder and stop
>     5) if there is an error on the validation step, then move the file
> immediately to a failedValidation folder and stop
>     I could not find a way to do this easy:
>     If I let the exceptions in 4) and 5) be unhandled, the file consumes
> my input file infinitely. This breaks 4) and 5)
>     If I handle the exceptions in 4) and 5) (handled(true)) the input is
> processed, breaks again 4) and 5)
>     If I set moveFailed on the file, there is no way to distinguish the
> failedValidation and the failedPrcessing, without writing lots of scary
> code

Hmm that code doesn't need to be scary

Then just set a header with the key whereTo. So just before the
processing step you do
.setHeader("whereTo", "processFailedFolder")

And just before wen you do the validation you do
.setHeader("whereTo", "validationFailedFolder")

>     One way to solve the issues would be to have another option,
> deleteFailed=true|false, to prevent the infinite consume and let the route
> to determine what to do with the file
>     If I could be able to set deleteFailed=true|false, then i can add
> .to(file:${}) in the exception handlers to save the file.
>     What do you think?
> InterComponentWare AG:
> Vorstand: Peter Kirschbauer (Vors.), Jörg Stadler
> Aufsichtsratsvors.: Prof. Dr. Christof Hettich
> Firmensitz: 69190 Walldorf, Altrottstraße 31
> AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516

Claus Ibsen
Twitter: davsclaus
Author of Camel in Action:

View raw message