camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mitko.ko...@icw.de
Subject Re: File component - infinite consume on failure
Date Fri, 14 Jan 2011 09:22:45 GMT
Hi Claus, 

Thank you for your answer.
Your suggestion seems simple and I'll use it

Regards, 
Mitko





From:
Claus Ibsen <claus.ibsen@gmail.com>
To:
users@camel.apache.org
Date:
13.01.2011 15:07
Subject:
Re: File component - infinite consume on failure



On Tue, Jan 11, 2011 at 3:24 PM,  <mitko.kolev@icw.de> 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
moveFailed=${header.whereTo}

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:${file.name}) 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
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/




   
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  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message