Notification Federation

All notifications emitted from managed nodes are federated to all JMX Managers in the system.

These notifications are federated and then emitted by the DistributedSystemMXBean. If you attach a javax.management.NotificationListener to your DistributedSystemMXBean, the NotificationListener can listen to notifications from all MemberMXBeans and all CacheServerMXBeans.

Attaching Listeners to MXBeans

When you attach a notification listener to the DistributedSystemMXBean, the DistributedSystemMXBean then acts as the notification hub for the entire distributed system. You do not have to attach a listener to each individual member or cache server MBean in order to listen to all the notifications in the distributed system.

The following is an example of attaching a NotificationListener to an MBean using the JMX MBeanServer API:
NotificationListener myListener = ...
ObjectName mbeanName = ... 
MBeanServer.addNotificationListener(mbeanName, myListener, null, null);  
JMX Managers will emit notifications for all distributed system members with two exceptions:
  • If you use cache.xml to define resources such as regions and disks, then notifications for these resources are not federated to the JMX Manager. In those cases, the DistributedSystemMXBean cannot emit those notifications.
  • If a JMX Manager is started after a resource has been created, the JMX Manager cannot emit notifications for that resource.

System Alert Notifications

System alerts are GemFire alerts wrapped within a JMX notification. The JMX Manager registers itself as an alert listener with each member of the system, and by default, it receives all messages logged with the SEVERE alert level by any node in the distributed system. Consequently, the DistributedSystemMXBean will then emit notifications for these alerts on behalf of the DistributedSystem.

By default, the JMX Manager registers itself to send notifications only for SEVERE level alerts. To change the alert level that the JMX Manager will send notifications for, use the DistributedMXBean.changeAlertLevel method. Possible alert levels to set are WARNING, ERROR, SEVERE, and NONE. After changing the level, the JMX Manager will only emit that level of log message as notifications.

Notification objects include type, source and message attributes. System alerts also include the userData attribute. For system alerts, the notification object attributes correspond to the following:
  • type: system.alert
  • source: Distributed System ID
  • message: alert message
  • userData: name or ID of the member that raised the alert