You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by edvicif <ed...@gmail.com> on 2013/03/28 16:25:57 UTC

Refering implicitly to routeContext

Hi

I want to develop an interceptor, which I can turn on on demand using spring
DSL, by adding the xml file to the spring configuration list.

So what I want to have
myInterceptor.xml

<routeContext id="sg">
  <interceptFrom uri="direct:something"/>
  <to uri="..."/>
</routeContext>

Sometimes I want to run configs: normal-config.xml
but sometimgs normal-config.xml,myInterceptor.xml

I was only able to find examples, that I explicit refer to these context
through:

<routeContextRef ref="sg"/> in the camelContext node. But I want to avoid it
as I don't want to modify the original camelContext definition.

The camelContext has packageScan and contextScan function. I was able to
achieve my goal with that to dynamically add route. Unfortunately I have to
define the route using JAVA.

Can I achieve somehow, that if I list of the XML files for Spring and
contains route definitions beans they add them self to the camelContext?

I understand there will be an issue, when I define multiple camel context.

Other think I realized that if I want to define an interceptor in
routeContext I must define a dummy from, to node before the interceptor
definition. Am I doing something wrong here?



--
View this message in context: http://camel.465427.n5.nabble.com/Refering-implicitly-to-routeContext-tp5730047.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Refering implicitly to routeContext

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Apr 2, 2013 at 11:21 AM, edvicif <ed...@gmail.com> wrote:
> I like both idea. With the second one the problem is that it doesn't have
> this silent extension capability what I want :(
>
> Shall I create a JIRA task of this?
>

Yeah feel free to create a JIRA ticket.



>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Refering-implicitly-to-routeContext-tp5730047p5730204.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Refering implicitly to routeContext

Posted by edvicif <ed...@gmail.com>.
I like both idea. With the second one the problem is that it doesn't have
this silent extension capability what I want :(

Shall I create a JIRA task of this?



--
View this message in context: http://camel.465427.n5.nabble.com/Refering-implicitly-to-routeContext-tp5730047p5730204.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Refering implicitly to routeContext

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah maybe we should have a <routeContextScan pattern="foo*"/> or
something that can supporting looking up and adding any <routeContext>
that matches this pattern. Then you can have this "flexibility" you
are talking about.

Though it may get a little bit harder to implement as its during the
xml parsing, and usually you need to know the exact names of the
"elements" you refer to, so eg "foo*" is maybe hard to match and bind
to "foo-bar", "foo-cafe" if you have 2 <routeContext> with those ids.

So not sure if we can implement it like that, and have it work in both
spring and blueprint.

Though an alternative could be to add a "mandatory=true|false"
attribute to the existing <routeContextRef"> so you can tell it to
silently ignore if the routeContext wasn't found.




On Thu, Mar 28, 2013 at 4:25 PM, edvicif <ed...@gmail.com> wrote:
> Hi
>
> I want to develop an interceptor, which I can turn on on demand using spring
> DSL, by adding the xml file to the spring configuration list.
>
> So what I want to have
> myInterceptor.xml
>
> <routeContext id="sg">
>   <interceptFrom uri="direct:something"/>
>   <to uri="..."/>
> </routeContext>
>
> Sometimes I want to run configs: normal-config.xml
> but sometimgs normal-config.xml,myInterceptor.xml
>
> I was only able to find examples, that I explicit refer to these context
> through:
>
> <routeContextRef ref="sg"/> in the camelContext node. But I want to avoid it
> as I don't want to modify the original camelContext definition.
>
> The camelContext has packageScan and contextScan function. I was able to
> achieve my goal with that to dynamically add route. Unfortunately I have to
> define the route using JAVA.
>
> Can I achieve somehow, that if I list of the XML files for Spring and
> contains route definitions beans they add them self to the camelContext?
>
> I understand there will be an issue, when I define multiple camel context.
>
> Other think I realized that if I want to define an interceptor in
> routeContext I must define a dummy from, to node before the interceptor
> definition. Am I doing something wrong here?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Refering-implicitly-to-routeContext-tp5730047.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen