There are two issues that we are facing: Issue 1:
We are trying exception handling in following route <route id="A" trace="true" errorHandlerRef="eh"> <from uri="openAPI" /> <onException> <exception>java.lang.Exception</exception> <redeliveryPolicy logRetryAttempted="true" retryAttemptedLogLevel="WARN" maximumRedeliveries="2" /> </onException> <onException> <exception>com.example.InvalidParameterException</exception> <redeliveryPolicy logRetryAttempted="true" retryAttemptedLogLevel="WARN" maximumRedeliveries="4" /> </onException> <convertBodyTo type="java.util.Map" /> <setHeader headerName="integrationType"> <constant>SOAP</constant> </setHeader> <process ref="headerProcessor" /> <bean ref="serviceHelperMapper" method="route" /> <choice> <when> <simple>${header.requestType} == 'broadcast'</simple> <bean ref="broadcasterBean" method="route" /> </when> <when> <simple>${header.requestType} == 'forward'</simple> <bean ref="dynamicRouterBean" method="route" /> </when> <otherwise> <bean ref="dynamicRouterBean" method="route" /> </otherwise> </choice> <convertBodyTo type="com.example.SoapMap" /> </route> Is this the standard way to handle exceptions in camel routes? If not what is the recommended way of handling it? Other option is to configure it using onWhen. Onexception block will only be triggered if it matches the header type. <onException> <exception>com.example.InvalidDestinationException</exception> <onWhen> <simple>${header.requestType} == 'broadcast'</simple> </onWhen> <redeliveryPolicy maximumRedeliveries="6" /> <handled> <constant>true</constant> </handled> </onException> Issue 2: Another issue that we have is when we try the same exception handling within when case of choice, it doesn't work. <choice> <when> <onException> <exception>com.example.InvalidDestinationException</exception> < redeliveryPolicy logRetryAttempted="true" retryAttemptedLogLevel="WARN" maximumRedeliveries="6" /> </onException> <simple>${header.requestType} == 'forward'</simple> <bean ref="dynamicRouterBean" method="route" /> </when> </choice> Regards, Aryan -- View this message in context: http://camel.465427.n5.nabble.com/Handling-error-per-endpoint-tp5757191p5757284.html Sent from the Camel - Users mailing list archive at Nabble.com.