You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marcos Díez Fernández <md...@tecsisa.com> on 2011/05/27 11:33:57 UTC
How to remove interceptors?
Hi all,
As suggested by book/documentation I'm using adviceWith method to add interceptors to my existing routes, like this:
for (int i = 0; i < camelContext.getRouteDefinitions().size(); i++) {
camelContext.getRouteDefinitions().get(i).adviceWith(camelContext, new RouteBuilder() {
public void configure() throws Exception {
intercept().process(customCamelAuditorProcessor);
}
});
}
Question is, would it be possible to remove/disable the added interceptors?
Thanks in advance,
BR,
Marcos.
RE: How to remove interceptors?
Posted by Marcos Díez Fernández <md...@tecsisa.com>.
Thanks both, very helpful answers!
BR,
Marcos.
--------------------------------------------------------
View this message in context: http://camel.465427.n5.nabble.com/How-to-remove-interceptors-tp4431339p4432115.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to remove interceptors?
Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,
There are 2 ways to do this.
a> Static: You do not get rid of the interceptor (i.e the interceptor does
get invoked but you eject immediately if a header value (boolean) is set in
the payload. This will allow you to switch the interceptor code on/off on
demand.
b> Dynamic: You stop to the route, modify the route and re-load the route
without the interceptor. The camel context has API's to add/modify/remove
routes in a running camel context. The side-effect of this is that the route
is unavailable for a small period of time.
Hope this helps.
Cheers,
Ashwin...
-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com
Blog: http://opensourceknowledge.blogspot.com
CamelOne 2011: http://fusesource.com/camel2011
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-remove-interceptors-tp4431339p4432115.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to remove interceptors?
Posted by Donald Whytock <dw...@gmail.com>.
You can use intercept().when(predicate).process(processor) and have
predicate depend on a settable value.
Don
2011/5/27 Marcos Díez Fernández <md...@tecsisa.com>:
> Hi all,
>
> As suggested by book/documentation I'm using adviceWith method to add interceptors to my existing routes, like this:
>
> for (int i = 0; i < camelContext.getRouteDefinitions().size(); i++) {
> camelContext.getRouteDefinitions().get(i).adviceWith(camelContext, new RouteBuilder() {
> public void configure() throws Exception {
> intercept().process(customCamelAuditorProcessor);
> }
> });
> }
>
> Question is, would it be possible to remove/disable the added interceptors?
>
> Thanks in advance,
> BR,
> Marcos.
>