3 Replies Latest reply on Nov 8, 2006 4:46 AM by mskonda

    Why am I not receiving Notifications?

    mskonda Apprentice

      My primary goal is to receive notifications from Naming (JNDI) MBean - that is, receive notifications for any additions or deletions or modificatios to the JNDI namespace.

      I have followed the wiki ListenerServiceMBeanSupport example and created a dummy notication lsitener which just prints out the info messages.

      The xxx-service.xml is given below:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <server>
      
       <mbean code="com.cmi2.facility.notifications.JNDINotificationListener"
       name="cmi2-listeners:faciltiy=jndiNotifactionListener">
       <attribute name="SubscriptionList">
       <subscription-list>
       <mbean name="jboss:service=Naming">
       <filter factory="AttributeChangeNotificationFilterFactory">
       <enable attribute-name="State"/>
       <enable attribute-name="Name"/>
       <enable attribute-name="MethodMap"/>
       </filter>
       </mbean>
       </subscription-list>
       </attribute>
       </mbean>
      </server>


      Unfortunately I can't get see any notifications received when I bind/unbind objects to the jndi namespace.

      My listener is below:
      public class JNDINotificationListener extends ListenerServiceMBeanSupport
       implements JNDINotificationListenerMBean {
       /*
       * Logger
       */
       private Logger logger =
       Logger.getLogger(AbstractFlowComponent.class.getName());
      
       public JNDINotificationListener()
       {
       logger.info("JNDINotificationListener constructor");
       }
      
       public void startService() throws Exception
       {
       super.subscribe(true);
       }
      
       public void stopService() throws Exception
       {
       super.unsubscribe();
       }
       public void handleNotification2(Notification n, Object handBack)
       {
       logger.info("Received Notification: "+n+", handback: "+handBack);
       }
      }
      
      


      Ideally i want to extend the notification listeners for other services too..

      Any pointers to what I'm doing wrong?

      Thanks
      Madhu

        • 1. Re: Why am I not receiving Notifications?
          Dimitris Andreadis Master

          I don't remember if the naming service produces notifications when things are bound/unbound. Are you sure?

          • 2. Re: Why am I not receiving Notifications?
            mskonda Apprentice

            I am assuming and expecting Naming MBean to produce Notifications, but not sure it does. I'll check the source code to see if I can dig any info on this.

            If Naming MBean doesn't produce notifications as I assumed, do you know if any way I can achieve the same thing, Dimitris? Or is it easy for me to incorporate code change to produce notifications (perhaps feature request?)

            Thanks
            Madhu

            • 3. Re: Why am I not receiving Notifications?
              mskonda Apprentice

              You are correct that the Naming service does not produce Notifications on bind/rebind/unbind operations (I'm looking at org.jnp.server.NamingServer.java).

              Well, as I have a requirement to listen to the notifications, I am wonderign the best way to proceed to incorporate notification broadcasting from NamingSever.

              I think I have two ways

              1. Incorporate notifications in NamingServer itself (this means I'll have to change the code)

              2. Extend NamingServer with notification broadcast support.

              I am not sure how the second point turns out to be.

              Any ideas/suggestions?

              Thanks
              Madhu