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?

Reply via email to