4 Replies Latest reply on May 12, 2011 5:13 PM by genman

    JMX notifications; mc4j

    genman

      Thinking about integrating JMX notifications with RHQ, but I'm not sure how to use the MC4J API.

       

      What I think will work is:

      public interface EmsBean extends Comparable {
      
          /**
           * Returns the set of all notifications for this MBean; never null.
           *
           * @return the set of all notifications for this MBean; never null
           */
          SortedSet<EmsNotification> getNotifications();
      

       

      Then iterate over the set (?) and then call:

      public interface EmsNotification extends Comparable {
      
          void addNotificationListener(EmsNotificationListener listener);
      

       

      The callback would emit an event to RHQ, right? Or do I need to add to the set myself?

       

      The thing is, the JMX API basically has something like MBeanServer.addNotificationListener(...) . I'm looking for the source to see what goes on here.

        • 1. JMX notifications; mc4j
          pilhuhn

          Elias,

          ems is a wrapper around JMX that especially was needed in the early days when there was no common JMX remoting (probably not exactly the right technical term) as in JDK 5. So every vendor had their own way of talking to JMX and even between different versions of an app server, different libraries were often needed. Ems took care of all that and abstracted away.

           

          Having said that, I don't think this is enough to get notifications into RHQ, as EMS does not know about RHQ.

           

          Have a look at this blog posting about Events and especially the referenced snmptrapd plugin and especially its SnmpEventPoller class. The TwitterEventPoller from the Twitter plugin is a more simple version of this, but the Twitter plugin is probably not working right now due to Twitter's switch to OAuth.

          • 2. JMX notifications; mc4j
            genman

            Heiko,

             

            I think I know how to get events into RHQ, I just don't know how to get them from JMX with MC4J/EMS. MC4J seems to be quite dead at the moment, at least on SourceForge there's not any activity. I can always poke into the source code, I suppose.

            • 3. JMX notifications; mc4j
              mazz

              Elias - some of us are committers to MC4J / EMS and we've committed bug fixes/enhancements to it in the past. In fact, up until a few months ago, Greg (the owner and original author of MC4J) used to work on the RHQ team here at RedHat.

               

              It isn't dead in the sense that it is a big part of several of our plugins - so we take care that it is still functional.

               

              If you grab the source and make some good enhancements/modifications to it, feel free to post what you do/did and we'll see if we can commit it to the MC4J / EMS project. One thing that is interesting is trying to convert JMX notifications to RHQ events via the JMX plugin and EMS. We've not done this in the past but it looks like you are looking in the right places.

               

              I would recommend doing this kind of communication over the RHQ developer mailing list (rhq-devel - see https://fedorahosted.org/mailman/listinfo/rhq-devel )

              • 4. JMX notifications; mc4j
                genman

                Thanks, I'll subscribe...