You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Janario Oliveira <ja...@gmail.com> on 2015/03/20 22:49:30 UTC
Intercept (before and after) routes invocations
Hi guys,
I'm trying to enable a custom cdi scope on all process routes.
So I'd like to run some code before and after all routes execution.
It could be before/after the route execution or before a bean/process
invocation:
.bean(myCustomScope, "startCustom")
.bean(myBean, "myMethod")
.bean(myCustomScope, "endCustom")
Is there an easy way to do this?
Re: Intercept (before and after) routes invocations
Posted by janario <ja...@gmail.com>.
Thanks gsegares_cr, but I was looking for something more global.
I've found InterceptStrategy. So I added it to
CamelContext.addInterceptStrategy and wrap the target Processor:
void process(Exchange exchange) {
try {
myCustomScope.startCustom();
target.process();
} finally {
myCustomScope.stoptCustom()
}
}
That fit very well as I've seen.
Thanks.
--
View this message in context: http://camel.465427.n5.nabble.com/Intercept-before-and-after-routes-invocations-tp5764529p5764555.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Intercept (before and after) routes invocations
Posted by gsegares_cr <sg...@gmail.com>.
Try AOP http://camel.apache.org/aop.html
--
View this message in context: http://camel.465427.n5.nabble.com/Intercept-before-and-after-routes-invocations-tp5764529p5764554.html
Sent from the Camel - Users mailing list archive at Nabble.com.