You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mi...@icw.de on 2011/01/11 15:24:04 UTC

File component - infinite consume on failure

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

     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  

Re: Testing the subscription

Posted by davsclaus <ci...@yahoo.dk>.
Then don't use nabble to post, but your existing mail client. eg if you use
google mail then its just your web browser. If you use MS outlook then use
that.

Check in your spam folder if mails from the Camel user list is moved there
by your mail client/server.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Can-t-subscribe-to-the-Mailing-list-tp3331852p3377091.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: File component - infinite consume on failure

Posted by mi...@icw.de.
Hi Claus, 

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

Regards, 
Mitko





From:
Claus Ibsen <cl...@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,  <mi...@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  

Re: File component - infinite consume on failure

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jan 11, 2011 at 3:24 PM,  <mi...@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/