Jul 28th, 2006, 07:14 AM
Listening for notifications from a different application
I have the following scenario:
- Several webapps in different servers. Each one with several MBeans registered using Spring support with their corresponding MBeanServers.
- A different app must listen to the notifications sent by the webapps MBeans (then it has to forward them to different systems, but that's not relevant).
How can I listen for remote notifications? Is it possible using Spring support? If not... could somebody point me in the right direction to do it directly with JMX API?
I know I can invoke methods in remote MBeans using client-side JSR-160 connectors (MBeanServerConnectionFactoryBean) and proxies (MBeanProxyFactoryBean) but I don't think I can listen to the notifications that those MBeans send...
Thanks in advance,
Aug 12th, 2006, 04:06 AM
The answer might depend on what you mean by "notifications", but if you already have a client-side API (e.g. JSR160) that is at least half the battle, so you could probably use it in some way.
Do you want to publish ApplicationEvents in your remote applications? This could be achieved by writing a special MBean that fires an ApplicationEvent, e.g. taking a String argument as the name of a prototype bean of the correct type, resolving it in the BeanFactory and then publishing. It depends on the complexity of your events, how easy it is to achieve something useful with this approach. There is nothing out of the box to directly support this pattern (as far as I am aware) because the ApplicationEvents would be specific to your implementation.
Aug 12th, 2006, 04:27 AM
I realized that you probably mean "notifications" as in javax.management.Notification. Duh! Anyway, I guess you just need to set up your client to invoke the methods that cause the notifications on the remote bean.
Feb 18th, 2010, 05:55 AM
JMX Notifications with Spring
You can find an example of how to do that here
Last edited by erezmazor; Feb 25th, 2010 at 03:35 AM.