Grokbase Groups Camel users June 2012
FAQ
Hello,
I want to know how to add a Global 'interceptFrom()' like construct for all
routes in a Camel Context. I have say 4 - 5 independent Route Builders
defined using the Java DSL which I am adding to a Camel Context defined in
Spring through the <routebuilder ref=""/> declaration.

Now I want to include a single interceptFrom [Also defined as part of a
common RouteBuilder using Java] which would intercept all messages coming on
all routes defined in all the route builders which reside in the context

Unfortunately, the interceptFrom() only seems to intercept messages for
those routes which are defined in the same RouteBuilder class as the
interceptFrom() itself. Is there a way to intercept messages for all
incoming messages for all routes that the camel context holds?
Regards,
Sushil

--
View this message in context: http://camel.465427.n5.nabble.com/Global-Interceptor-for-all-incoming-Messages-tp5714820.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Search Discussions

  • Claus Ibsen at Jun 21, 2012 at 9:15 am

    On Thu, Jun 21, 2012 at 10:47 AM, sushil_vsk5 wrote:
    Hello,
    I want to know how to add a Global 'interceptFrom()' like construct for all
    routes in a Camel Context. I have say 4 - 5 independent Route Builders
    defined using the  Java DSL which I am adding to a Camel Context defined in
    Spring through the <routebuilder ref=""/> declaration.

    Now I want to include a single interceptFrom [Also defined as part of a
    common RouteBuilder using Java] which would intercept all messages coming on
    all routes defined in all the route builders which reside in the context

    Unfortunately, the interceptFrom() only seems to intercept messages for
    those routes which are defined in the same RouteBuilder class as the
    interceptFrom() itself. Is there a way to intercept messages for all
    incoming messages for all routes that the camel context holds?
    Regards,
    Sushil
    You can have a base RouteBuilder class (extending the Camel
    RouteBuilder) where you add the global stuff.

    And then extend this class from your routes, and invoke the super.
    configure() method first, so the base class code is included.

    --
    View this message in context: http://camel.465427.n5.nabble.com/Global-Interceptor-for-all-incoming-Messages-tp5714820.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    Twitter: davsclaus, fusenews
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen
  • Sushil_vsk5 at Jun 21, 2012 at 10:26 am
    Hello Claus,
    Thanks a lot for the quick reply. I can very well do that in case I am the
    one who is writing all the Routes. But that is not the case. Actually,
    people who will be writing the routes can belong to different teams and I
    really do not have much control over what they are putting into their routes
    and which classes they extend.

    But I want to have the ability to inject some cross-cutting concerns before
    the routes are getting called in a generic fashion (I would be the one who
    will have control on what goes into the Camel Context as well). So, without
    the constraint of having all developers extending from a custom RouteBuilder
    class, is there any other way I can achieve this? Can I use an
    IntercepyStrategy or something?

    Regards,
    Sushil

    --
    View this message in context: http://camel.465427.n5.nabble.com/Global-Interceptor-for-all-incoming-Messages-tp5714820p5714827.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • James Carman at Jun 21, 2012 at 11:19 am
    Hmmmm. Cross-cutting concerns. Sounds like a job for AspectJ?
    On Thu, Jun 21, 2012 at 6:00 AM, sushil_vsk5 wrote:
    Hello Claus,
    Thanks a lot for the quick reply. I can very well do that in case I am the
    one who is writing all the Routes. But that is not the case. Actually,
    people who will be writing the routes can belong to different teams and I
    really do not have much control over what they are putting into their routes
    and which classes they extend.

    But I want to have the ability to inject some cross-cutting concerns before
    the routes are getting called in a generic fashion (I would be the one who
    will have control on what goes into the Camel Context as well). So, without
    the constraint of having all developers extending from a custom RouteBuilder
    class, is there any other way I can achieve this? Can I use an
    IntercepyStrategy or something?

    Regards,
    Sushil

    --
    View this message in context: http://camel.465427.n5.nabble.com/Global-Interceptor-for-all-incoming-Messages-tp5714820p5714827.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Claus Ibsen at Jun 21, 2012 at 11:47 am

    On Thu, Jun 21, 2012 at 12:00 PM, sushil_vsk5 wrote:
    Hello Claus,
    Thanks a lot for the quick reply. I can very well do that in case I am the
    one who is writing all the Routes. But that is not the case. Actually,
    people who will be writing the routes can belong to different teams and I
    really do not have much control over what they are putting into their routes
    and which classes they extend.

    But I want to have the ability to inject some cross-cutting concerns before
    the routes are getting called in a generic fashion (I would be the one who
    will have control on what goes into the Camel Context as well). So, without
    the constraint of having all developers extending from a custom RouteBuilder
    class, is there any other way I can achieve this? Can I use an
    IntercepyStrategy or something?
    Its on the roadmap for Camel 3.0 to allow to hot deploy / instrument
    cross cutting concerns
    to existing CamelContext's on the fly.

    In the 2.x version you need to do this up-front.

    Regards,
    Sushil

    --
    View this message in context: http://camel.465427.n5.nabble.com/Global-Interceptor-for-all-incoming-Messages-tp5714820p5714827.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    Twitter: davsclaus, fusenews
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen
  • wing-tung Leung at Jun 21, 2012 at 12:33 pm

    2012/6/21 sushil_vsk5 <sushil_vsk5@yahoo.co.in>:
    Unfortunately, the interceptFrom() only seems to intercept messages for
    those routes which are defined in the same RouteBuilder class as the
    interceptFrom() itself. Is there a way to intercept messages for all
    incoming messages for all routes that the camel context holds?
    We used a custom route policy applied to a list of specific routes,
    which runs the same set of checks on those routes, at the start of the
    route.

    Or something else:

    http://java.dzone.com/articles/aspect-oriented-programming-camel


    Maybe that could help you?

    Tung

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedJun 21, '12 at 9:12a
activeJun 21, '12 at 12:33p
posts6
users4
websitecamel.apache.org

People

Translate

site design / logo © 2022 Grokbase