Results 1 to 4 of 4

Thread: Problem with notifications

  1. #1
    Join Date
    Mar 2006
    Location
    Spain
    Posts
    41

    Default Problem with notifications

    Hi all, I've come to a dead point with notifications. I want to use Spring features in this sense, but I'm having some troubles:

    - If I use normal beans (not MBeans) and I expose them using Spring and InterfaceBasedMBeanInfoAssembler, the JMX console (I've tried with MC4J and JConsole) never knows about notifications, because this method on AbstractMBeanInfoAssembler which is not overriden on InterfaceBasedMBeanInfoAssembler:
    Code:
    	protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey)
    			throws JMException {
    		return new ModelMBeanNotificationInfo[0];
    	}
    It seems like I could solve it using MetadataMBeanInfoAssembler, but the use of metadata (annotations) is not acceptable on this project (don't ask me why, it is not my decision).


    - If I try with a different approach, with my beans implementing an MBean interface and NotificationEmitter interface (and without using any assembler), the console shows the notifications info successfully, but I never get a NotificationPublisher instance, even if I implement NotificationPublisherAware, so I'm not able to publish the notifications. It seems like I only can use the NotificationPublisher feature if Spring is creating their own MBeans, not if I have existing ones.

    Any idea is greatly appreciated...

    Best regards,

    Jose Luis.

  2. #2
    Join Date
    Mar 2006
    Location
    Spain
    Posts
    41

    Default Still not working but...

    Hi,

    just to share my progress... I didn't realize InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanInfoAssembler. This bean has capabilities to define the notifications that are going to be thrown by the MBeans through the properties notificationInfos and notificationInfoMappings (that are poorly documented, same that the bean itself, but it is still a RC, I hope they will be a bit more documented in the final release).

    Example:
    Code:
    	<bean id="interfaceBasedAssembler" class="org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler">
    		<property name="managedInterfaces">
    			<value>es.indra.ibuilder.jmx.mbeans.BaseMBean,es.indra.ibuilder.jmx.mbeans.MonitorizableMBean,es.indra.ibuilder.jmx.mbeans.SLAbleMBean</value>
    		</property>
    		<property name="notificationInfoMappings">
    			<map>
    				<entry key="pruebadozer3:type=service,service=es.indra.pruebadozer.servicios.SrvPruebaImpl,name=es.indra.pruebadozer.servicios.SrvPruebaImpl" value-ref="SLANotification"/>
    		  		<entry key="pruebadozer3:type=service,subtype=operation,service=es.indra.pruebadozer.servicios.SrvPruebaImpl,name=getPrueba" value-ref="SLANotification"/>
    				<entry key="pruebadozer3:type=service,subtype=operation,service=es.indra.pruebadozer.servicios.SrvPruebaImpl,name=setPrueba" value-ref="SLANotification"/>
    			</map>
    		</property>
    	</bean>
    With this configuration, the method getNotificationInfo returns the notification's information to construct the ModelMBean but...

    - With the MC4J console the notifications are shown in the tree but I'm not able to listen them because an exception arise (maybe a MC4J problem).

    - With JConsole the notifications tab is not available (and it was when I exposed directly as an MBean implementing NotificationEmitter).

    - AdvenNet AppManager says that the MBean don't send notifications.

    - Similar with JManage...

    So I think the MBean still is not informing correctly that it can send notifications... ¿any idea?

    Thanks in advance,

    Jose Luis.

  3. #3
    Join Date
    Apr 2006
    Posts
    3

    Default

    Do you have something like

    es.indra.ibuilder.jmx.mbeans.Monitorizable (implementation) which implements
    es.indra.ibuilder.jmx.mbeans.MonitorizableMBean ?

    and use the MBeanExporter?

    If so, then the MBeanExporter will treat this as a Standard MBean and not wrap it with a ModelMBean implementation. The notification support will not be available in this case.

  4. #4
    Join Date
    Mar 2006
    Location
    Spain
    Posts
    41

    Default

    Yep, now I know it... it was one of the first approaches I tried. Now I have a 'MonitorizableMBean' interface and a 'MonitorizableMBeanImpl' implementation, so they are not exposed directly but wrapped with a ModelMBean so notification support is available.

    I also use the 'notificationInfoMappings' property to provide information about the notifications the MBean can send. However, for any reason I don't know, the JMX consoles are not able to receive notifications (but Spring notifications listeners can).

    When I used the approach you describe (plus implementing NotificationEmitter interface), the consoles were able to detect the MBean send notifications and were able to subscribe to them. However, I wasn't able to send them because I didn't have the Spring support (somebody has a piece of JMX code to send notifications manually?)

    I don't know if I'm doing something wrong or Spring is not exposing correctly the information about the MBean's notifications.

    Thanks in advance,

    José Luis.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •