I finally managed to rewrite my route using a conditional try-catch (ie with
<onWhen>):

<route id="processUpdateBatch" errorHandlerRef="DLQ_solr_batches">
            <from uri="activemq:queue:solr-batches"/>
            <doTry>
                <to uri=""http:..."/>                   
                <doCatch>
                   <exception>java.lang.Exception</exception>
                   <onWhen>                     
                       <simple>${headers.batch_size} &gt; 1</simple>
                   </onWhen>                                                    
                   <to uri="direct:splitAndResubmit"/>                          
                                
               </doCatch>                                       
            </doTry>                    
 </route>

The only remaining (and serious) problem I am facing, is that the exchange
is *NOT* put in my DQL when the onWhen predicate is not satisfied (I guess
the handled flag is set by default to true in a try-catch ?)

But how can I model the following behaviour:
a) if (exception) AND (batch_size>1) : do a specific process (here:
splitAndResubmit) and silently ignore error
b) if (exception) AND (batch_size=1) : use the error handler specified on
the route level (in my case a DeadLetterChannel with a redeliveryPolicy) ?

In my solution, a) is working fine, but not b)






--
View this message in context: 
http://camel.465427.n5.nabble.com/Conditional-route-scoped-onException-tp5731725p5731779.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to