FAQ
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?

Search Discussions

  • Gsegares_cr at Mar 22, 2015 at 5:47 am
    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.
  • Janario at Mar 22, 2015 at 5:47 am
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedMar 21, '15 at 5:52a
activeMar 22, '15 at 5:47a
posts3
users2
websitecamel.apache.org

2 users in discussion

Janario: 2 posts Gsegares_cr: 1 post

People

Translate

site design / logo © 2021 Grokbase