I have the following context level OnException.  After it catches an error,
it would send out an email alert using a direct-vm route.  But to avoid
infinite loop, the email alert is only sent if the OnException is not
entered due to a nested exception.

When the direct-vm consumer is not started and there is an exception (e.g.
ValidationException), the OnException is entered and then fail with
org.apache.camel.component.directvm.DirectVmConsumerNotAvailableException
which is expected.  I had expected that the
DirectVmConsumerNotAvailableException is caught by the OnException again.
But it was not. I need to catch it so that the original ValidationException
can be "handled".  Any suggestion?

<c:onException>
        <c:exception>org.apache.camel.InvalidPayloadException</c:exception>
        <c:exception>org.apache.camel.ValidationException</c:exception>
        <c:exception>org.apache.camel.CamelException</c:exception>
        <c:exception>org.apache.camel.CamelExchangeException</c:exception>

<c:exception>org.apache.camel.component.directvm.DirectVmConsumerNotAvailableException</c:exception>
        <c:exception>java.lang.Exception</c:exception>
        <c:exception>java.lang.RuntimeException</c:exception>
        <c:handled><c:constant>true</c:constant></c:handled>
        <c:choice>
                <c:when><c:groovy>exchange.properties.eb_already_in_recovery !=
'true'</c:groovy>
                    <c:setProperty propertyName="eb_already_in_recovery">       
     
<c:constant>true</c:constant></c:setProperty>
                    <c:setExchangePattern pattern="InOnly" />
                    <c:to uri="direct-vm:sendEmailAlert" />
                </c:when>
                <c:otherwise>
                        <c:log message="***** Failed again in error recovery:
${property.CamelExceptionCaught}."/>
                </c:otherwise>
        </c:choice>
</c:onException>



--
View this message in context: 
http://camel.465427.n5.nabble.com/DirectVmConsumerNotAvailableException-cannot-be-caught-by-onException-tp5775185.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to