Hi Claus

Thanks for that clue. I tried something like follows as I see the method
dumpStatisticsAsJson() is already implemented in
org.apache.camel.component.metrics.routepolicy.MetricsRegistryService class.

Hope this is a sane way of trying to get something out from the method. 

*<camelContext xmlns="http://camel.apache.org/schema/spring";
id="myCamelContext">
        <propertyPlaceholder id="placeholder"
location="classpath:appConfigs.groovy" />
                <routeBuilder ref="VMMVendorIntegrationRoute"/>

        <route id="metrics-dump">
            <from uri="timer://foo?fixedRate=true&amp;period=15000"/>
            <bean ref="metricsRegistryService"
method="dumpStatisticsAsJson"/>
            <log message="JSON Dump - ${body}"/>
        </route>

        </camelContext>

    <bean id="metricsRegistryService"
class="org.apache.camel.component.metrics.routepolicy.MetricsRegistryService">
        <property name="metricsRegistry" ref="metricRegistry"/>
        <property name="prettyPrint" value="true"/>
        <property name="jmxDomain" value="org.apache.camel.metrics"/>
        <property name="useJmx" value="true"/>
    </bean>*

However, I get exception 
[Camel (myCamelContext) thread #3 - timer://foo] WARN
org.apache.camel.component.timer.TimerConsumer - Error processing exchange.
Exchange[Message: [Body is null]]. Caused by:
[java.lang.NullPointerException - null]
java.lang.NullPointerException

*Looks like this method doesn't take any arguments. Why should this
exception show up? Is there a work around for this.

I even tried setting some dummy value in exchange Body.. Now I get a
different exception as follows. Any clue how I can make a call to the
method?
*
java.lang.NullPointerException
        at
org.apache.camel.component.metrics.routepolicy.MetricsRegistryService.dumpStatisticsAsJson(MetricsRegistryService.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at 
org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)
        at
org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)
        at
org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)
        at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:171)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:165)
        at
org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:73)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
[Camel (myCamelContext) thread #3 - timer://foo] WARN
org.apache.camel.component.timer.TimerConsumer - Error processing exchange.
Exchange[Message: testValue]. Caused by: [java.lang.NullPointerException -
null]
java.lang.NullPointerException
        at
org.apache.camel.component.metrics.routepolicy.MetricsRegistryService.dumpStatisticsAsJson(MetricsRegistryService.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at 
org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)
        at
org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)
        at
org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)
        at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:171)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)



-----
Reji Mathews
Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & 
Jboss Fuse ESB | Mule ESB )
LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
Twitter - reji_mathews
--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Metrics-over-Spring-metrics-tp5773518p5773527.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to