-
1. Re: MBean as NotificationBroadcaster
arondaniel Apr 27, 2006 3:36 PM (in response to ghilling)Good question Gunnar -- I have the same question myself.
So JBoss folks... whats the answer?
How does an EJB3 @Management @Service supposed to send a notification?
Thanks,
-Aron"ghilling" wrote:
Hello,
I'm just playing around a little with ejb3 and I'm trying to build an MBean with Notification Support.
I thought it should be enough to declare interface as NotificationBroadcaster (as I did) and use NotificationBroadcasterSupport as base class for the implementation but when I try to register a notification listener I get an
The MBean named exists but does not implement the NotificationBroadcaster interface.
Is this just not possible without writing deployment descriptors (old style) or am I getting something wrong (some extra annotation perhaps?).
Regards,
-Gunnar -
2. Re: MBean as NotificationBroadcaster
bill.burke Apr 27, 2006 9:52 PM (in response to ghilling)please log a feature request in jira, we'll get to it eventually...
-
3. Re: MBean as NotificationBroadcaster
bill.burke Apr 27, 2006 9:52 PM (in response to ghilling)or you can fiddle working it out yourself.
-
4. Re: MBean as NotificationBroadcaster
bergander Dec 7, 2006 5:31 AM (in response to ghilling)I am not experiencing the "The MBean named exists but does not implement the NotificationBroadcaster interface"-error that you get as long as I specify the mbean and not the management interface (type=Management) as a broadcaster.
But my problem is that although the log files tells me that my broadcaster has been subscribed to by the listener, the listener does not receive any notifications.
After some investigation I found out that when using a ListenerServiceMBeanSupport together with a SubscriptionList configuration to subscribe to notifications sent by an EJB3 service bean it seems like the ListenerServiceMBeanSupport bean subscribes to the ServiceDelegateWrapper class instead of the defined bean in the SubscriptionList.
To work around this the following code could be added to the ServiceDelegateWrapper class:@Override public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) { if (delegate instanceof ServiceContainer) { try { ((ServiceContainer) delegate).invoke("addNotificationListener", new Object[] {listener, filter, handback}, new String[] {"javax.management.NotificationListener", "javax.management.NotificationFilter", "java.lang.Object"}); } catch (Exception e) { throw new RuntimeException(e); } } } @Override public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) { if (delegate instanceof ServiceContainer) { try { ((ServiceContainer) delegate).invoke("removeNotificationListener", new Object[] {listener, filter, handback}, new String[] {"javax.management.NotificationListener", "javax.management.NotificationFilter", "java.lang.Object"}); } catch (Exception e) { throw new RuntimeException(e); } } }
This has been tested with the 4.0.5 GA release and it seems to work fine. Is this a good way of solving this? Any other suggestions?