You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ghosh <bu...@gmail.com> on 2011/04/26 11:32:25 UTC

Interceptor in onexception route

I have some routes defined along with onException route like below

<onException>
    <exception>com.mycompany.MyException</exception>
     <log message="befor ex1" />
     <to uri="ex1" />
     <log message="befor ex2" />
     <to uri="ex2" />
</onException>

<route id="id1">
     <from uri="uri1" >
     <to uri="uri2" />
</route>

<route id="id2">
     <from uri="uri21" >
     <to uri="uri22" />
</route>

I have a context wide interceptor defined which intercepts each endpoint and
based on 
endpoint uri it performs some action. It works perfectly fine if there is no
exception.

Now whenever an exception comes, the onexception gets invoked and my
interceptor is supposed to perform custom tracking activities there. but, In
case of onException route I noticed that
the interceptor is not able to get the current endpoint uri (whereas in
normal processing it is able to), I tried  "exchange.getUnitOfWork()
.getRouteContext().getEndpoint().getEndpointUri()" and as well as
"definition.getLabel"
where definition is processor definition.
My question here is can we intercept an onException route ? If yes, what is
best way to 
get the current endpoint uri ?


Regards,
Ghosh

--
View this message in context: http://camel.465427.n5.nabble.com/Interceptor-in-onexception-route-tp4340475p4340475.html
Sent from the Camel - Users mailing list archive at Nabble.com.