Thanks, adding "implements Service" did the trick. Pretty easy to add JMX management features this way!
Any advice on this part of the question?: > Also, this mbean is published in jmx hierarchy in > > my-host-name/290-xyroutename/ processors/mybeansName > > where 290 is the bundle ID (so not static). How can I configure the mbean > to be registered with some specific name? I want to create a programmatic health checker which tests my mbean, so I would need it's name to be something predefined. 2014-03-07 17:50 GMT+02:00 Claus Ibsen <[email protected]>: > Hi > > If I remember you need to implement Service too for custom mbeans. > Or extend ServiceSupport. > > > On Fri, Mar 7, 2014 at 4:44 PM, janne mattila <[email protected]> > wrote: > > I am trying to add JMX based healthcheck monitoring to my routes. I > > followed instructions from > > > http://michalwarecki.blogspot.fi/2012/08/monitoring-and-managing-apache-camel.html( > "Custom > > MBean"). My custom MBean looks like: > > > > @ManagedResource(description = "Statictics Processor") > > public class TestMBean implements Processor { > > > > private int totalRequests; > > > > private int totalCharacters; > > > > @ManagedAttribute > > public int getAvgChar() { > > return totalCharacters / totalRequests; > > } > > > > @ManagedAttribute > > public int getTotalChar() { > > return totalCharacters; > > } > > > > public void process(Exchange exchange) throws Exception { > > ++totalRequests; > > totalCharacters += ((String) > > exchange.getIn().getBody(String.class)).length(); > > } > > } > > > > and it has been added to my route. When I use hawtio web console to > inspect > > my routes, the processor is there but it does not have the getAvgChar / > > getTotalChar operations. Only the default operations, available for all > > processors, are there. > > > > What is wrong and should I do something else completely to publish a new > > JMX MBean from a Camel route running inside ServiceMix container? > > > > Also, this mbean is published in jmx hierarchy in > > > > my-host-name/290-xyroutename/processors/mybeansName > > > > where 290 is the bundle ID (so not static). How can I configure the mbean > > to be registered with some specific name? > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > Email: [email protected] > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen > Make your Camel applications look hawt, try: http://hawt.io >
