>From the groovyRouteBuilder, we can only get a routeBuild, which may have several routes in it and doesn't support to setId.
janstey wrote: > > I don't think you should be taking route definitions from one camel > context > and loading them into another... I'm surprised this actually works! Also, > I'm not really following why you need a 2nd context to set the id... did > you > try just using one? > > On Thu, Aug 13, 2009 at 10:19 AM, xueqiang.mi <allo...@gmail.com> wrote: > >> >> I found that the addRouteDefinitions method of camel context caused this >> problem. It seems that this method transform the interceptDefinition into >> a >> interceptStrategy. >> Before updating a route, I use a temporary camel context to generate the >> route definition from a route builder, so I can obtain the route >> definition >> and reserve its id. Code is as follows: >> {code} >> // add the route builder into a temporary camel context >> CamelContext tempContext = new DefaultCamelContext(); >> tempContext.addRoutes(builder); >> // get all the added routes and add them into current context >> List<RouteDefinition> routeDefinitions = >> tempContext.getRouteDefinitions(); >> for (int i = 0; i < routeDefinitions.size(); i++) { >> RouteDefinition routeDefinition = routeDefinitions.get(i); >> // set id only for the first route >> if (i == 0) >> routeDefinition.setId(id); >> >> // add or update the route >> >> >> getCamelContext().addRouteDefinitions(Collections.singletonList(routeDefinition)); >> } >> {code} >> >> Then the addRouteDefinitions method is used to add the route definition >> to >> current camel context and it causes that problem: transforming the >> interceptDefinition into a interceptStrategy. Through test, this >> operation >> has brought some other similar problems for other DSLs. >> >> Are there any suggestions to solve it? >> >> xueqiang.mi wrote: >> > >> > Hi, >> > When I tested the intercept DSL, I encountered a problem. >> > I found sometimes the route maintains the intercept definition as a >> output >> > processor in outputs list, but sometimes, it hold the intercept >> > configuration in its interceptStrategies list. I don't what causes the >> > difference and how to differentiate them. >> > >> > >> > JIRA j...@apache.org wrote: >> >> >> >> groovy renderer >> >> --------------- >> >> >> >> Key: CAMEL-1392 >> >> URL: >> >> https://issues.apache.org/activemq/browse/CAMEL-1392 >> >> Project: Apache Camel >> >> Issue Type: Sub-task >> >> Reporter: James Strachan >> >> >> >> >> >> >> >> >> >> -- >> >> This message is automatically generated by JIRA. >> >> - >> >> You can reply to this email to add a comment to the issue online. >> >> >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24954096.html >> Sent from the Camel Development mailing list archive at Nabble.com. >> >> > > > -- > Cheers, > Jon > > http://janstey.blogspot.com/ > > -- View this message in context: http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24954718.html Sent from the Camel Development mailing list archive at Nabble.com.