After trying to grok the intercept code a bit, I'm gonna +1 Claus'
suggestion :)

As a side note for any Camel users listening in, the intercept stuff in 2.0
is *much* easier to use than 1.x from a users standpoint - its just complex
under the hood.

On Thu, Aug 13, 2009 at 10:50 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:

> On Thu, Aug 13, 2009 at 3:10 PM, Jon Anstey<jans...@gmail.com> 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?
> >
>
> The "hidden" and advanced stuff such as interceptors / on exception
> and the likes is not easy to distill back as there is special code in
> Camel to take core of the routes is assembled correctly according to
> how big impacts such cross cutting features impose.
>
> So I do think the dynamic editor at present time should *not* have
> such features to express. If we can do it for regular routes with then
> we got far.
> In the future we can have a better model that caters for tooling for
> cross cutting functions such as interceptors.
>
>
>
> > 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/
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>



-- 
Cheers,
Jon

http://janstey.blogspot.com/

Reply via email to