Java Reference
In-Depth Information
You can specify an MBean server and a default domain name for this element through the server
and default-domain attributes. However, you won't be able to set other MBean exporter properties such
as notification listener mappings. Whenever you have to set these properties, you need to declare an
AnnotationMBeanExporter instance explicitly.
6-2. Publishing and Listening to JMX Notifications
You want to publish JMX notifications from your MBeans and listen to them with JMX notification
Spring allows your beans to publish JMX notifications through the NotificationPublisher interface .
You can also register standard JMX notification listeners in the IoC container to listen to JMX
How It Works
Publishing JMX Notifications
The Spring IoC container supports the beans that are going to be exported as MBeans to publish JMX
notifications. These beans must implement the NotificationPublisherAware interface (as you might
implement ApplicationContextAware to receive a reference to the current bean's containing
ApplicatonContext instance) to get access to NotificationPublisher so that they can publish
package com.apress.springenterpriserecipes.replicator;
import org.springframework.jmx.export.notification.NotificationPublisher;
import org.springframework.jmx.export.notification.NotificationPublisherAware;
@ManagedResource(description = "File replicator")
public class FileReplicatorJMXImpl implements FileReplicator,
NotificationPublisherAware {
private int sequenceNumber;
private NotificationPublisher notificationPublisher;
public void setNotificationPublisher(
NotificationPublisher notificationPublisher) {
this.notificationPublisher = notificationPublisher;
Search WWH ::

Custom Search