On Fri, Jul 29, 2011 at 6:07 AM, xiangqiuzhao <[email protected]> wrote:
> i have get some endpoint uri strings,
>
> and some route be defined as
>
> from(endpoint1).to(direct:name)
> from(endpoint2).to(direct:name)
> ...
>
> i have new CamelContext(), and want to add these route to it then start.
> how to add dynamic use api, not use like :
>
Its just java code so you can use for loops etc. to add X number of routes
context.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
for (int i = 0; i < 10; i++) {
from("endpoint1" + i)
.to("direct:name" + i);
}
});
If you do not want to use the RouteBuilder, then you can manually
build routes using the classes in the org.apache.camel.model package.
> because i don't know how many route i should add, i must parse my configure
> file to add dynamic
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/how-to-add-some-routes-to-CamelContext-by-hand-tp4644999p4644999.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/