On Fri, Mar 15, 2013 at 3:20 PM, Henri Tremblay <henri.tremb...@gmail.com> wrote: > Ok. That's what I thought. It is still strange since technically it is two > routes (and the JMX does give me stats on both on them). >
Its not strange, there is events like ExchangeSentToEndpoint you can use instead etc. See all the event classes we have in the events package. Also you may consider looking at tracer for fine grained tracing / metrics collection http://camel.apache.org/tracer And the new backlog tracer in Camel 2.11 http://camel.apache.org/backlogtracer.html > I'll look at the proposed tools and give you some feedback. > > Thanks! > Henri > > > On 15 March 2013 13:11, Claus Ibsen <claus.ib...@gmail.com> wrote: > >> On Fri, Mar 15, 2013 at 12:48 PM, Henri Tremblay >> <henri.tremb...@gmail.com> wrote: >> > Hi, >> > >> > I would like to use Camel with Perf4j. >> > >> > I know that Camel JMX already provide statistics but I would like to be >> > able to easily see at once all my routes performance and be able generate >> > nice graph. Perf4j allows me to do that quickly (you know another tool >> that >> > will do the same with Camel?) >> > >> >> Yes hawtio can monitor Camel apps. I suggest to take a look. >> In the upcoming 1.1 release there is going to be a new plugin for >> showing stats, us >> http://hawt.io/ >> >> And there is also a tool called CamelWatch >> http://sksamuel.github.com/camelwatch/ >> >> >> >> > My first try was to extend EventNotifierSupport and react >> > to ExchangeCreatedEvent and ExchangeCompletedEvent. Basically this: >> > >> > public void notify(EventObject event) throws Exception { >> > Exchange exchange = (Exchange) event.getSource(); >> > String tag = exchange.getFromRouteId() + "-" + >> > exchange.getFromEndpoint(); >> > if (event instanceof ExchangeCreatedEvent) { >> > StopWatch watch = new Slf4JStopWatch(tag); >> > exchange.setProperty(STOP_WATCH_KEY + tag, watch); >> > } else if (event instanceof ExchangeCompletedEvent) { >> > StopWatch watch = (StopWatch) >> exchange.removeProperty(STOP_WATCH_KEY >> > + tag); >> > watch.stop(); >> > } >> > } >> > >> > Of course it doesn't really work. There is no way to have the route id it >> > seems. Or at least I have strange result. My routes are: >> > >> > from("sql:...").setRouteId("a").to("direct-foo"); >> > from("direct:foo").setRouteId("b").to("http:..."); >> > >> > And instead of getting something like >> > Created a >> > Completed a >> > Created b >> > Completed b >> > >> > I receive something like >> > Created a-null >> > Created a-a >> > Completed a-a >> > Completed a-a >> > >> > Any idea why it behaves like this and what I can do? >> > >> > Thanks >> > Henri >> >> You should likely only react to created / completed events. And that >> is why you may get a null in the from route. >> And when you use the direct component its NOT creating a new Exchange >> but routing the existing exchange. >> And hence why you wont see events for creating / completed from route b. >> >> >> >> -- >> Claus Ibsen >> ----------------- >> Red Hat, Inc. >> FuseSource is now part of Red Hat >> Email: cib...@redhat.com >> Web: http://fusesource.com >> Twitter: davsclaus >> Blog: http://davsclaus.com >> Author of Camel in Action: http://www.manning.com/ibsen >> -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen