Hi I have created a ticket to improve the CBR to be more fine grained (its a very often used EIP and it would be nice to have a fine grained insight, this helps the tracer as well)
https://issues.apache.org/jira/browse/CAMEL-4050 On Sat, Jun 4, 2011 at 11:58 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > Hi > > The child-parent relationship is based on a per EIP principle. So they > get assigned the ChoiceDefinition (= the CBR EIP) as their parent. So > you will have to drill down in the CBR if you want to pin point more > fine grained where the child is associated. > > However setting the id on the .otherwise() will currently set it on > the ChoiceDefinition. We ought to set the id on the > OtherwiseDefinition. I will get that fixed. > > On Thu, Jun 2, 2011 at 11:44 PM, Javier Arias Losada > <javier.ari...@gmail.com> wrote: >> Hello all, >> >> I am working on a full traceability solution on my camel routes, for that, I >> am using a custom interceptor. >> >> The problem is that the parent-child relation is not correctly set when >> InterceptStrategy.wrapProcessorInInterceptors() is called. >> >> I am working with a patched camel 2.2.0, to include ticket 3928 >> https://issues.apache.org/jira/browse/CAMEL-3928 >> Also, I repeated the tests with the last snapshot: revision 1130773, with >> same results. >> >> For example, in the following route: >> >> from("direct:start").routeId("route") >> .choice().id("choice") >> .when(new XPathExpression("/x")).id("when") >> .log(" A").id("task1") >> .log(" B").id("task2") >> .otherwise().id("otherwise") >> .log(" C").id("task3") >> .end() >> .to("mock:done"); >> >> I use a custom interceptor to show each processor and its parent: >> >> getContext().addInterceptStrategy(new InterceptStrategy() { >> @Override >> public Processor wrapProcessorInInterceptors(CamelContext >> context, ProcessorDefinition<?> definition, final Processor target, >> Processor nextTarget) throws Exception { >> String targetId = definition.hasCustomIdAssigned() ? >> definition.getId() : definition.getLabel(); >> ProcessorDefinition<?> parentDefinition = >> definition.getParent(); >> >> String parentId = null; >> >> if(parentDefinition != null){ >> parentId = parentDefinition.hasCustomIdAssigned() ? >> parentDefinition.getId() : parentDefinition.getLabel(); >> } >> >> logger.info(">>>>>>>>> parentId="+parentId+" >> targetId="+targetId); >> >> return new Processor() {//return mock-empty processor. >> @Override >> public void process(Exchange exchange) throws Exception >> { >> // mock processor >> target.process(exchange); >> } >> }; >> } >> }); >> >> >> I was expecting the following output: >> >> parent: when targetid: task1 >> parent: when targetid: task2 >> parent: otherwise targetid: task3 >> >> Also, as you can notice, each processorDefinition is handled twice, anybody >> knows why? >> >> The output is: >> INFO: >>>>>>>>> parentId=otherwise targetId=task1 >> INFO: >>>>>>>>> parentId=otherwise targetId=task1 >> INFO: >>>>>>>>> parentId=otherwise targetId=task2 >> INFO: >>>>>>>>> parentId=otherwise targetId=task2 >> INFO: >>>>>>>>> parentId=otherwise targetId=task3 >> INFO: >>>>>>>>> parentId=otherwise targetId=task3 >> INFO: >>>>>>>>> parentId=route targetId=otherwise >> INFO: >>>>>>>>> parentId=route targetId=otherwise >> INFO: >>>>>>>>> parentId=route targetId=mock:done >> INFO: >>>>>>>>> parentId=route targetId=mock:done >> >> Thank you very much. >> Javier Arias. >> > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/