How about using the below code to look up the MetricsRegistry :)

context.getRegistry().lookupByNameAndType(“metricRegistry”, 
MetricRegistry.class);

--  
Willem Jiang


Blog: http://willemjiang.blogspot.com (English)  
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On September 7, 2016 at 5:01:35 AM, SaurabhNayar (nayar.saur...@gmail.com) 
wrote:
> I have incorporated Camel Statistics in my project. And they are awesome. I
> am trying to capture custom statistics for idempotent Consumer component
> like below: .to("metrics:timer:idempotentTimer?action=start")
> .idempotentConsumer(simple("${body.id}"), jdbcMessageIdRepository)
> .to("metrics:timer:idempotentTimer?action=stop")For some reason, I am not
> able to get the metrics idempotentTimer from the following code:
> MetricsRegistryService metricsRegistry =
> context.hasService(MetricsRegistryService.class); if(metricsRegistry
> != null) { return metricsRegistry.dumpStatisticsAsJson();
> }Or from MetricsMessageHistoryService metricsRegistry =
> context.hasService(MetricsMessageHistoryService.class);
> if(metricsRegistry != null) { return
> metricsRegistry.dumpStatisticsAsJson(); }Any ideas.
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-Metrics-tp5787256.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to