-
1. Re: Problem with notification filter?
dimitris Oct 25, 2006 3:22 AM (in response to mcevikce)You have misspelled "JMX.mbeank" (k)
You may try also MBeanServerNotificationFilterFactory, if interested in receiving register/unregister notifications for particular mbeans (enable object-name="...") -
2. Re: Problem with notification filter?
mcevikce Oct 25, 2006 9:05 AM (in response to mcevikce)I have corrected the spelling mistake and still getting notifications from JMImplementation:type=MBeanServerDelegate with type = JMX.mbean.registered. I also tried with filter:
<filter factory="NotificationFilterSupportFactory"> <enable type="JMX.mbean.registered"/> <enable type="JMX.mbean.unregistered"/> </filter>
Here is the config:<mbean code="com.bfm.app.monitoring.ViewserverJMXNotificationHandler" name="jboss.monitor:service=ViewserverMonitoring" > <attribute name="SubscriptionList"> <subscription-list> <mbean name="jboss.monitor:service=MemoryMonitor"> <notification type="jboss.alarm.memory"/> </mbean> <mbean name="jboss.monitor:service=JDBCMonitor"> <notification type="jboss.notification.jdbc"/> </mbean> <mbean name="jboss.system:service=Logging,type=JMXNotificationAppender"> <notification type="jboss.notification.logging"/> </mbean> <mbean name="JMImplementation:type=MBeanServerDelegate"> <filter factory="NotificationFilterSupportFactory"> <enable type="JMX.mbean.registered"/> <enable type="JMX.mbean.unregistered"/> </filter> </mbean> </subscription-list> </attribute> </mbean>
-
3. Re: Problem with notification filter?
dimitris Oct 25, 2006 10:01 AM (in response to mcevikce)Correct
-
4. Re: Problem with notification filter?
mcevikce Oct 25, 2006 10:05 AM (in response to mcevikce)But still getting the notifications!!!! Isn't that supposed to filter the notifications?
-
5. Re: Problem with notification filter?
dimitris Oct 25, 2006 10:14 AM (in response to mcevikce)You have understood wrong. The filter specifies which notifications to allow, not which to discart.
-
6. Re: Problem with notification filter?
mcevikce Oct 25, 2006 10:35 AM (in response to mcevikce)Then what is the difference between:
<mbean name="JMImplementation:type=MBeanServerDelegate"> <filter factory="NotificationFilterSupportFactory"> <enable type="JMX.mbean.registered"/> <enable type="JMX.mbean.unregistered"/> </filter> </mbean>
and:<mbean name="JMImplementation:type=MBeanServerDelegate"> <notification type="jMX.mbean.registered"/> <notification type="jMX.mbean.unregistered"/> </mbean>
If they are the same the how would I filter out a specific notification type? I am tring to NOT to receive bean registeration messages. -
7. Re: Problem with notification filter?
dimitris Oct 25, 2006 12:29 PM (in response to mcevikce)The 2 examples are equivalent. The 2nd was the initial syntax, the 1st was a more generic extension that allowed the plugin-in of arbitrary filter factorys.
I've provided already 4 filter factories that all work by 'enabling' what you want to receive.
It wouldn't be very hard to extend those or write your own filter factory that works by instead 'disabling' what you don't want to receive.
However, when it comes to the notifications emitted by the MBeanServerDelegate mbean, there is little point in disabling those 2 notifications types, because those are the only notifications this mbean produces. If you don't want to receive them, simply remove this mbean from the subscription list. -
8. Re: Problem with notification filter?
mcevikce Oct 25, 2006 6:41 PM (in response to mcevikce)Thank you for the prompt replies. Unfortunalty removing the mbean from the subscription does not stop the messages from coming in. Is this something by defeault all MBeans register to?
this is what I removed:<mbean name="JMImplementation:type=MBeanServerDelegate"> <filter factory="NotificationFilterSupportFactory"> <enable type="JMX.mbean.registered"/> <enable type="JMX.mbean.unregistered"/> </filter> </mbean>
this is the config:<mbean code="com.bfm.app.monitoring.ViewserverJMXNotificationHandler" name="jboss.monitor:service=ViewserverMonitoring" > <attribute name="SubscriptionList"> <subscription-list> <mbean name="jboss.monitor:service=MemoryMonitor"> <notification type="jboss.alarm.memory"/> </mbean> <mbean name="jboss.monitor:service=JDBCMonitor"> <notification type="jboss.notification.jdbc"/> </mbean> <mbean name="jboss.system:service=Logging,type=ViewserverNotificationAppender"> <notification type="jboss.notification.logging"/> </mbean> </subscription-list> </attribute> </mbean>
-
9. Re: Problem with notification filter?
mcevikce Oct 26, 2006 9:29 AM (in response to mcevikce)I found out what was happening. I should have mentioned that my ViewserverJMXNotificationHandler extends from ListenerServiceMBeanSupport
which in the the init method subscribed to Mbean registeration typeprivate void init() { // just pickup a unique object this.myHandback = new Integer(Integer.MAX_VALUE); // allow only registration events this.myFilter = new NotificationFilterSupport(); this.myFilter.enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION); }
I was avoding to implement all the subscription and notification methods which are already provided by the ListenerServiceMBeanSupport. -
10. Re: Problem with notification filter?
dimitris Nov 1, 2006 7:36 AM (in response to mcevikce)If you read carefully http://www.jboss.org/wiki/Wiki.jsp?page=ListenerServiceMBeanSupport
you must override handleNotification2(), not handleNotification().
This is needed so the baseclass can implement dynamic subscriptions, if needed.