I broke the route up into two routes and it seems to be working fine.

Thanks Matt



SoaMattH wrote:
> 
> 
> The problem:
> Occasionally I am getting poorly formed XML and am trying to fixit on the
> fly.
> Most of the time I can, 1% of the time I cannot.
> 
> In the route below this is what I want to do
> 1. pick up the file.
> 2. Use Jaxb to unmarshal
> 3. call the validate bean
> 4. call the incidentReceiverFile bean 
> 5. on sucessfull completion the file ends up in a processed directory
>     On failure it ends up in the dead letter folder.
> 
> The route works well for well formed XML, if the unmarshal throws an error
> It calls the incidentValidate?method=filterBadUTFEncoding, most of the
> time this works
> except for when my filterBadUTFEncoding cannot fix the bad XML (Which is
> about 1% of the time)
> On this case I want the file to go to dead letter folder.
> 
> 
> The Route:
> <camel:route errorHandlerRef="incidentDeadLetter" id="incidentFileRouteA">
>   <camel:from ref="incidentFileEndPoint" />
>     <camel:doTry>
>       <camel:unmarshal ref="incidentJaxb" />
>       <camel:doCatch>
>         <camel:exception>org.xml.sax.SAXParseException</camel:exception>
>        
> <camel:exception>org.apache.xerces.impl.io.MalformedByteSequenceException</camel:exception>
>         <camel:handled>
>           <camel:constant>true</camel:constant>
>         </camel:handled>
>         <!-- retry by trying to fix the xml -->
>         <camel:to uri="bean:incidentValidate?method=filterBadUTFEncoding"
> />
>         <!-- If unmarshal fails should the camel:onException catch Me -->
>         <camel:unmarshal ref="incidentJaxb" />
>       </camel:doCatch>
>     </camel:doTry>
>         
>     <camel:to uri="bean:incidentValidate?method=validate" />
>     <camel:to uri="bean:incidentReceiverFile?method=processIncident" />
>         
>     <camel:onException useOriginalMessage="true" >
>     <camel:exception>java.lang.Exception</camel:exception>
>       <camel:redeliveryPolicy maximumRedeliveries="0" />
>       <camel:handled>
>         <camel:constant>true</camel:constant>
>       </camel:handled>
>     <camel:to
> uri="log:au.gov.qld.des.integration.oms.business.incident?level=FATAL"/>
>     <camel:to uri="bean:incidentDeadLetter" />
>     <camel:to uri="log:au.gov.qld.des?showAll=true&amp;level=FATAL"/>
>   </camel:onException>
> </camel:route>     
> 
> 
> I am expecting the <camel:onException> to catch any errors out of the on
> catch retry ....
> is this so ? the file stays in the incidentFileEndPoint directory that the
> route watches and trys
> to process over and over ....... What am I missing ??
> 
> Thanks Matt
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Error-Handling%3A-mix-of-onTry...OnCatch-and-%3ConException%3E-tp25746191p25757182.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to