Spring Integration

org.springframework.integration.jmx
Class NotificationListeningMessageProducer

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
          extended by org.springframework.integration.endpoint.MessageProducerSupport
              extended by org.springframework.integration.jmx.NotificationListeningMessageProducer
All Implemented Interfaces:
EventListener, NotificationListener, BeanFactoryAware, BeanNameAware, InitializingBean, Lifecycle, Phased, SmartLifecycle, MessageProducer, NamedComponent

public class NotificationListeningMessageProducer
extends MessageProducerSupport
implements NotificationListener

A JMX NotificationListener implementation that will send Messages containing the JMX Notification instances as their payloads.

Since:
2.0
Author:
Mark Fisher

Constructor Summary
NotificationListeningMessageProducer()
           
 
Method Summary
protected  void doStart()
          Registers the notification listener with the specified ObjectNames.
protected  void doStop()
          Unregisters the notification listener.
 String getComponentType()
          Subclasses may implement this method to provide component type information.
 void handleNotification(Notification notification, Object handback)
          Notification handling method implementation.
 void setFilter(NotificationFilter filter)
          Specify a NotificationFilter to be passed to the server when registering this listener.
 void setHandback(Object handback)
          Specify a handback object to provide context to the listener upon notification.
 void setObjectName(ObjectName objectName)
          Specify the JMX ObjectName of the notification publisher to which this notification listener should be subscribed.
 void setServer(MBeanServer server)
          Provide a reference to the MBeanServer where the notification publishing MBeans are registered.
 
Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport
onInit, sendMessage, setOutputChannel, setSendTimeout
 
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stop
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, toString, writeMessageHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NotificationListeningMessageProducer

public NotificationListeningMessageProducer()
Method Detail

setServer

public void setServer(MBeanServer server)
Provide a reference to the MBeanServer where the notification publishing MBeans are registered.


setObjectName

public void setObjectName(ObjectName objectName)
Specify the JMX ObjectName of the notification publisher to which this notification listener should be subscribed.


setFilter

public void setFilter(NotificationFilter filter)
Specify a NotificationFilter to be passed to the server when registering this listener. The filter may be null.


setHandback

public void setHandback(Object handback)
Specify a handback object to provide context to the listener upon notification. This object may be null.


handleNotification

public void handleNotification(Notification notification,
                               Object handback)
Notification handling method implementation. Creates a Message with the JMX Notification as its payload, and if the handback object is not null, it sets that as a Message header value. The Message is then sent to this producer's output channel.

Specified by:
handleNotification in interface NotificationListener

getComponentType

public String getComponentType()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this method to provide component type information.

Specified by:
getComponentType in interface NamedComponent
Overrides:
getComponentType in class IntegrationObjectSupport

doStart

protected void doStart()
Registers the notification listener with the specified ObjectNames.

Specified by:
doStart in class AbstractEndpoint

doStop

protected void doStop()
Unregisters the notification listener.

Specified by:
doStop in class AbstractEndpoint

Spring Integration

Copyright © 2010. All Rights Reserved.