Reputation: 3049
I have a route like that :
onException(classOf[RuntimeException]).process(runtimeProcessor).process(doSmth).log(LoggingLevel.INFO, "new", "${exchangeId} --- ${exception.stacktrace} ")
On the processor I do :
CustomException customException =new CustomException ()
exchange.setException(customException )
exchange.getOut.setBody(doc)
The issue now that after this processor , it doesn't go to other processors (i.e. in my case , it doesn't go to "doSmth" processor )
I guess that behavior is that I have changed the exception on the exchange that I have built my "onException" over it .
Is there any way to force to go on my route even after changing the Exchange's exception !!
Upvotes: 1
Views: 1944
Reputation: 3049
I was trying to wrap the caught exception that comes into the exchage and wrap it into another custom exception .
After this wrapping I need to set this exception into a custom exchange . I have discoverd later from @Claus Ibsen-2 on the camel forum that Camel won't cont. routing when I use
exchange.setException(ex)
I have managed to do some work around by doing the following @ processor :
exchange.getOut.setHeader("ex",customException)
then @Route :
this.onException(classOf[IOException]).process(doSmth).log(LoggingLevel.INFO, "new", ${in.header.ex} ")
It prints into my log the following and that what I exactly need from the beginning : CustomException: java.lang.IOException
Upvotes: 1