You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Dennis Sosnoski <dm...@sosnoski.com> on 2013/09/11 10:34:57 UTC

JMX notifications handling?

I'm trying to get JMX notifications working from the WS-RM code, to 
allow the application to monitor message acknowledgments. If I just 
implement the notification handling in the managed class 
(ManagedRMEndpoint) it looks like this doesn't get picked up by the 
dynamic proxy generated by the management code. I saw that there are 
org.apache.cxf.management.annotation.ManagedNotifications and 
...ManagedNotification so I also tried using these, but they don't seem 
to change anything and since they're not used elsewhere it's not clear 
to me how these are supposed to work.

Any suggestions on getting this going?

Thanks,

   - Dennis


Re: JMX notifications handling?

Posted by Dennis Sosnoski <dm...@sosnoski.com>.
Just to follow up for the archive, it looks like the notification 
handling was never fully implemented. I've worked around this by 
duplicating some of the code from the 
org.apache.cxf.management.jmx.InstrumentationManagerImpl class to create 
the RequiredModelMBean and register that directly. So instead of:

instrumentationManager.register(managedEndpoint);

I'm using:

                     ModelMBeanAssembler assembler = new 
ModelMBeanAssembler();
                     ModelMBeanInfo mbi = 
assembler.getModelMbeanInfo(managedEndpoint.getClass());
                     MBeanServer mbs = 
instrumentationManager.getMBeanServer();
                     RequiredModelMBean rtMBean =
(RequiredModelMBean)mbs.instantiate("javax.management.modelmbean.RequiredModelMBean");
                     rtMBean.setModelMBeanInfo(mbi);
                     try {
rtMBean.setManagedResource(managedEndpoint, "ObjectReference");
                     } catch (InvalidTargetObjectTypeException itotex) {
                         throw new JMException(itotex.getMessage());
                     }
                     ObjectName name = managedEndpoint.getObjectName();
                     instrumentationManager.register(rtMBean, name);

Then I can just call the sendNotification() method on the 
RequiredModelMBean to pass notifications on to the client.

   - Dennis

On 09/11/2013 08:34 PM, Dennis Sosnoski wrote:
> I'm trying to get JMX notifications working from the WS-RM code, to 
> allow the application to monitor message acknowledgments. If I just 
> implement the notification handling in the managed class 
> (ManagedRMEndpoint) it looks like this doesn't get picked up by the 
> dynamic proxy generated by the management code. I saw that there are 
> org.apache.cxf.management.annotation.ManagedNotifications and 
> ...ManagedNotification so I also tried using these, but they don't 
> seem to change anything and since they're not used elsewhere it's not 
> clear to me how these are supposed to work.
>
> Any suggestions on getting this going?
>
> Thanks,
>
>   - Dennis
>