You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by tide08 <sa...@yahoo.com> on 2010/09/22 21:31:25 UTC

Using route as template to create dynamic routes

Hi,

Here is what I need, I suspect it is possible with camel but cannot figure
out how to achieve it. If anyone can give me some leads on how to achieve
this.

I have multiple routes, one of which is as below.

 <camel:route>
    <camel:from uri="queue:somequeue" />
    <camel:to uri="bean:someBean" />
    <camel:to uri="someProcessor" />
 </camel:route>

Depending on the environment, there can be more than entry points i.e.
multiple queue's to consume from. For ex: on QA env there is only 1 queue,
on Production there are 3 queues.

I see there are loadbalancer and dynamicRouter component but those are only
used in "to" part of route (atleast from examples I see).

So I was wondering if I can create routes dynamically using above route as
template. On start up, look at number of queue's and than for each queue
create copy of above route.

Or is there any better way to do this?

Thanks!


-- 
View this message in context: http://camel.465427.n5.nabble.com/Using-route-as-template-to-create-dynamic-routes-tp2850206p2850206.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using route as template to create dynamic routes

Posted by Willem Jiang <wi...@gmail.com>.
On 9/23/10 3:31 AM, tide08 wrote:
>
> Hi,
>
> Here is what I need, I suspect it is possible with camel but cannot figure
> out how to achieve it. If anyone can give me some leads on how to achieve
> this.
>
> I have multiple routes, one of which is as below.
>
>   <camel:route>
>      <camel:from uri="queue:somequeue" />
>      <camel:to uri="bean:someBean" />
>      <camel:to uri="someProcessor" />
>   </camel:route>
>
> Depending on the environment, there can be more than entry points i.e.
> multiple queue's to consume from. For ex: on QA env there is only 1 queue,
> on Production there are 3 queues.
>
> I see there are loadbalancer and dynamicRouter component but those are only
> used in "to" part of route (atleast from examples I see).

I don't think you can do it with spring configure.
But if you are using Java DSL, you can create the RouteBuilder with 
upper route configure  dynamically, and set the from endpoint as you 
want, then add it into the CamelContext as many as you want.

>
> So I was wondering if I can create routes dynamically using above route as
> template. On start up, look at number of queue's and than for each queue
> create copy of above route.
>
> Or is there any better way to do this?
>
> Thanks!
>
>

Willem
----------------------------------
Apache Camel, Apache CXF committer
Open Source Integration: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang