I don’t think you can handle route creation exceptions in the route builder - 
Camel is still constructing the route, so the route builder really can’t handle 
that type of exception.

Have you tried your route when you get an exception while processing an 
exchange?  It looks like it would work for that.


> On Mar 23, 2016, at 2:45 AM, mayur_bm <mayur...@gmail.com> wrote:
> 
> Hi,
> 
> i have onException configured for my camel context, which has  couple of
> routes. i have configured onException as below:
> 
>       <onException>
>    <exception>java.lang.Exception</exception>
> 
> 
>    <handled>
>      <constant>true</constant>
>    </handled>
>     <setHeader headerName="exception">
>                <simple>${exception.stacktrace}</simple>
>     </setHeader>
> 
>    <bean ref="frameWorkLogger" method="log"/>
>   </onException>
> 
> 
> 
> here since my component uses different logging framework, so i just want
> Camel runtime to call my custom method upon any kind of exception while
> initalizing routes or during Route Processing. upon calling i log messages
> using my custom logging framework. 
> 
> this is not working!!!
> 
> i just introduced one random exception by removing one custom camel
> component in route, same came runtime throws 
> 
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToCreateRouteException: Failed to create route sgDF13
> 
> but my custom bean method never get called!!, i implemented my bean as
> follows:
> 
> 
> import java.util.Map;
> 
> import org.apache.camel.Body;
> import org.apache.camel.Headers;
> import org.apache.camel.OutHeaders;
> 
> 
> public class FrameWorkLogger {
> 
>       public Object log(@Headers Map<?, ?> in, @Body String payload, 
> @OutHeaders
> Map out) {
> 
>               System.out.println("Calling FrameworkLogging");
>               Logging.log(this.getClass(), LogLevel.ERROR, "Calling 
> FrameworkLogging");
>               Logging.log(this.getClass(), LogLevel.ERROR, "Exception:-" + 
> payload);
>               return "Error";
>       }
> 
> }
> 
> How do i fix this issue?, please help...
> 
> Regards,
> mayur 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/onException-not-working-tp5779542.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to