0 Replies Latest reply on Mar 15, 2005 9:01 AM by dimitris

    Arbitrary JMX NotificationFilter(s) in ListenerServiceMBeanS

    dimitris

      The filtering mechanism that supported only a "fixed" NotificationFilterSupport filter has been extended to support arbitrary filters, using a filter factory plugin mechanism. To activate this feature use the following configuration syntax:

      <mbean code="some-ListenerServiceMBeanSupport-base-subclass"
       name="jboss.example:name=NotificationListener">
       ...
       <attribute name="SubscriptionList">
       <subscription-list>
       ...
       <mbean name="...">
       <!-- assign an arbitrary filter to this subscription -->
       <filter factory="filter-factory-class-name">
       <!-- configuration of the filter is different -->
       <!-- depending on the chosen factory -->
       </filter>
       </mbean>
       ...
       </subscription-list>
       </attribute>
       ...
      </mbean>
      

      For example:

      AttributeChangeNotificationFilterFactory
      This filter factory creates AttributeChangeNotificationFilters, configured to filter-in AttributeChangeNotifications for particular mbean attributes. For example, if you want to receive "State" change notifications from all mbeans in the jboss.system domain, use:
       ...
       <mbean name="jboss.system:*">
       <filter factory="AttributeChangeNotificationFilterFactory">
       <enable attribute-name="State"/>
       </filter>
       </mbean>
       ...
      

      MBeanServerNotificationFilterFactory
      This filter factory is really meant for filtering notifications from the MBeanServerDelegate mbean. Its primary purpose is to let you receive registration and/or unregistration notifications for selected ObjectNames (i.e. mbean instances). You need to configure both the notification types and the object names you are interested in. For example:
       ...
       <!-- filter in both JMX.mbean.registered & JMX.mbean.unregistered -->
       <mbean name="JMImplementation:type=MBeanServerDelegate">
       <filter factory="MBeanServerNotificationFilterFactory">
       <enable type="JMX.mbean.registered"/>
       <enable object-name="mydomain:name=somembean"/>
       <enable object-name="mydomain:name=anothermbean"/>
       </filter>
       </mbean>
       ...
      

      This is all documented here:
      http://www.jboss.org/wiki/Wiki.jsp?page=SubscriptionList

      (and here, too)
      http://www.jboss.org/wiki/Wiki.jsp?page=ListenerServiceMBeanSupport
      http://www.jboss.org/wiki/Wiki.jsp?page=ExampleMinimalNotificationListener

      The update will be available from the next jboss releases, i.e. v3.2.8RC1, v.4.0.2RC1