camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernard Ligny <bernard.li...@gmail.com>
Subject Re: Conditional route-scoped onException
Date Tue, 30 Apr 2013 09:56:49 GMT
Okay, i've just found a fully working solution. It is surely not the most
elegant one (as some code is repeated), but at least it works as expected...

The workaround consists in replacing the doCatch/onWhen (of previous post)
with an outer choice whose one branch contains the try/catch:

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

Hoping this post could help someone else...

Regards,

Bernard.

NB: I'm still interested in knowing/understanding why previous attempts did
not work.



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

Mime
View raw message