0

I am using JMX of spring Version 2.5 in which I am using JMX as shown below..

@ManagedOperation(description = "Mark the Entry corresponding ABC flow")
@ManagedOperationParameters(value = {
        @ManagedOperationParameter(name = "def", description = "Ids of the entries that needs to be STOP"),
        @ManagedOperationParameter(name = "Comments", description = "Note on why these entries are being marked as stop") })
public void abcstop(String def, String gtr){
    StringBuffer gfhtrPresent= jmxService.abcd(Ids, comments);
    if(idsNotPresent.length()>0) 
        throw new IOARuntimeException("<font color=red><b>No data found for the following id/id's </b></font>"+idsNotPresent);
}

Now I want to remove the @Managedoperation annaotation and want to configure it with in XML , please advsie how can I configure the @Managedoperation , as i wan the same functionality to be run from xml itself, Please advise.

one way to achieve this is implement your own MBeanInfoAssembler (or subclass one of the standard ones). please advise is there any other way to achieve this, Any early help would be appreciated.

user1633823
  • 347
  • 2
  • 5
  • 14

1 Answers1

0

The simplest way might be to use a InterfaceBasedMBeanInfoAssembler.

First, expose the JMX interface as an explicitly-defined interface in your code. (Having such an interface is probably a good idea anyway.) Then you just tell the InterfaceBasedMBeanInfoAssembler to expose a particular interface (or interfaces) via its managedInterfaces property. Apart from the defining the interface in the first place (which you might or might not have already done) the rest is entirely possible from XML configuration. But you won't be able to supply very detailed metadata this way; it's a trade-off.

If you're going to stick with a MetadataMBeanInfoAssembler, you could instead try a custom JmxAttributeSource so that you're only reinventing half the wheel and not the whole lot…

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
  • Thanks a lot can you please advise an example for that – user1633823 Jan 18 '14 at 07:59
  • Any example would help me to grasp more – user1633823 Jan 18 '14 at 08:01
  • Why did you ask a new question when you already asked me for more help with my answer to the initial question? http://stackoverflow.com/questions/21179066/replacing-managed-operation-from-xml-itself-in-spring You should at least have provided a link to that question here. I have now updated the other answer with more details. – Gary Russell Jan 18 '14 at 14:52