Change Notes item #893532, was opened at 2004-02-09 19:00
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=381174&aid=893532&group_id=22866

Category: JBoss/System
Group: v3.2
Status: Open
Priority: 5
Submitted By: Dimitris Andreadis (andd)
Assigned to: Nobody/Anonymous (nobody)
Summary: New baseclass org.jboss.system.ListenerServiceMBeanSupport

Initial Comment:
/**
 * An abstract base class that provides for declarative 
JMX notification
 * subscription handling.
 * <p>
 * A JBoss service that is in addition a 
NotificationListener can
 * subclass ListenerServiceMBeanSupport instead of 
ServiceMBeanSupport
 * and specify at instantiation-time, inline in the MBean 
descriptor using
the
 * SubscriptionList attribute, the set of 
MBeans/notifications the
 * service wants to subscribe/receive.
 * <p>
 * Just before start() the baseclass will register to those 
MBeans and for
 * those notifications that match the specified criteria. 
Similarly,
 * just after stop() the baseclass will automatically 
unsubscribe.
 * <p>
 * In addition, while started, it will monitor for 
registration events
 * from the MBeanServer and automatically subscribe to 
new instances
 * of MBeans that match the subscription criteria. 
Monitoring for
 * unsubscribe events in not necessary, since the 
MBeanServer
 * automatically removes subscriptions to unregistering 
MBeans.
 * <p>
 * Moreover, unless the service is properly started 
(state == STARTED)
 * all incoming notifications will be consumed.
 * <p>
 * To handle the incoming notifications override the 
handleNotification2()
 * method. The usual handleNotification() method should 
not be overriden,
 * since it is used to monitor the incoming notifications 
for registration
 * events coming from the MBeanServer, before 
delegating to
 * handleNotification2().
**/

There is also a NotificationListener that demonstrates 
the usage of the base
class:

(from monitoring-service.xml, uncomment to activate)

<!-- Example of listening for notifications from JBoss 
monitors

  <mbean 
code="org.jboss.monitor.notifications.NotificationListener"
         name="jboss.jmx:service=NotificationListener">
    <attribute name="SubscriptionList">
      <subscription-list>
        <mbean name="jboss.monitor:*">
          <notification 
type="JBOSS_MONITOR_NOTIFICATION"/>
        </mbean>
      </subscription-list>
    </attribute>
  </mbean>
-->

(The above example with the proper output formating is 
more or less
equivalent to the ConsoleAlertListener, but without the 
dependencies - I'll
come back with suggestions...)

You may specify arbitrary subscription rules, like:

      <subscription-list>
        <mbean name="*:service=invoker,*" 
handback="aHandbackString"/>
        <mbean 
name="JMImplementation:type=MBeanServerDelegate">
          <notification type="JMX.mbean.registered"/>
          [...]
        </mbean
        [...]
      </subscription-list>

or even:
   <mbean name="*:*"/>

You can easily monitor a single MBean, or the whole 
MBean server. You just
need to specify what to do with those Notifications.

Hope you find this useful. I've put a DTD at
system/src/resources/org/jboss/metadata/jboss-
subscription.dtd

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=381174&aid=893532&group_id=22866


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to