Here are the specs that I'm trying to implement in a nutshell:
1) Some Alerts have to be sent on certain events in the application.
2) These Alerts have Users subscribe to them.
3) And the Users have set their own Notification preferences (e.g. Email and/or SMS).
I have not been able to find an open source solution in Java so far.
Is JMX Notifications an option? The more I read about JMX, the more I feel that it is trying to achieve something different that my problem.
Any help would be useful.
The JMX API defines a mechanism to enable MBeans to generate notifications, for example, to signal a state change, a detected event, or a problem. To generate notifications, an MBean must implement the interface NotificationEmitter or extend NotificationBroadcasterSupport .
The dynamics of the JMX technology architecture enables you to use it to monitor and manage resources as they are implemented and installed. It can also be used to monitor and manage the Java Virtual Machine (JVM machine). Typical uses of the JMX technology include: Consulting and changing application configuration.
JMX Monitoring to Improve the Performance of Java Applications. Easily monitor JVMs and Java web application servers with the eG Enterprise JMX monitoring solution. Improve the performance of your applications by identifying bottlenecks at the code-level and in the infrastructure.
JMX can be a mechanism to solve this problem, but it's not the complete solution.
JMX provides facilities and services to your programs to allow clients to access monitoring data as well as allowing clients to make control calls to the application.
As you mentioned, one aspect of JMX is the notification system. What this system provides is infrastructure to make it easy for your program to make alerts and notifications available to clients, and modern JVMs also provide a free JMX server to allow client to connect to your application remotely and subscribe to those events.
But its one thing to make a JMX alert, and it's another thing completely to act on it.
What you would need to do is have some JMX client, somewhere, "subscribe" to the JMX notifications of your programs, and then THAT client can act upon those notification by sending emails, or whatever.
The JMX client can be a remote client talking to your application via TCP, or it can be an internal JMX client within the program, running in a thread, say, and it can act on the notifications.
So, basically, JMX provides the plumbing and infrastructure for what you want to do, but doesn't take it "the last mile" to converting alerts in to emails.
As @fawce mentioned, there are some "generic" JMX clients of various sophistication that can act upon JMX data and may do what you want (I'm not familiar with them, so I can not say first hand), or you can code your own system to monitor the JMX data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With