public class NotificationListeningMessageProducer
extends org.springframework.integration.endpoint.MessageProducerSupport
implements javax.management.NotificationListener, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
NotificationListener implementation that will send Messages
containing the JMX Notification instances as their payloads.lifecycleCondition, lifecycleLock| Constructor and Description |
|---|
NotificationListeningMessageProducer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStart()
Registers the notification listener with the specified ObjectNames.
|
protected void |
doStop()
Unregisters the notification listener.
|
java.lang.String |
getComponentType() |
void |
handleNotification(javax.management.Notification notification,
java.lang.Object handback)
Notification handling method implementation.
|
void |
onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
The
NotificationListener might not be registered on AbstractEndpoint.start()
because the MBeanExporter might not been started yet. |
protected java.util.Collection<javax.management.ObjectName> |
retrieveMBeanNames() |
void |
setFilter(javax.management.NotificationFilter filter)
Specify a
NotificationFilter to be passed to the server
when registering this listener. |
void |
setHandback(java.lang.Object handback)
Specify a handback object to provide context to the listener
upon notification.
|
void |
setObjectName(javax.management.ObjectName... objectNames)
Specify the JMX ObjectNames (or patterns)
of the notification publisher
to which this notification listener should be subscribed.
|
void |
setServer(javax.management.MBeanServerConnection server)
Provide a reference to the MBeanServer where the notification
publishing MBeans are registered.
|
afterSingletonsInstantiated, buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getMessagingTemplate, getOutputChannel, onInit, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrackdestroy, doStop, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, setTaskScheduler, start, stop, stopafterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, toStringpublic NotificationListeningMessageProducer()
public void setServer(javax.management.MBeanServerConnection server)
server - the MBean server connection.public void setObjectName(javax.management.ObjectName... objectNames)
objectNames - The object names.public void setFilter(javax.management.NotificationFilter filter)
NotificationFilter to be passed to the server
when registering this listener. The filter may be null.filter - The filter.public void setHandback(java.lang.Object handback)
handback - The object.public void handleNotification(javax.management.Notification notification,
java.lang.Object handback)
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.handleNotification in interface javax.management.NotificationListenerpublic java.lang.String getComponentType()
getComponentType in interface org.springframework.integration.support.context.NamedComponentgetComponentType in class org.springframework.integration.context.IntegrationObjectSupportpublic void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
NotificationListener might not be registered on AbstractEndpoint.start()
because the MBeanExporter might not been started yet.onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>event - the ContextRefreshedEvent eventprotected void doStart()
doStart in class org.springframework.integration.endpoint.MessageProducerSupportprotected void doStop()
doStop in class org.springframework.integration.endpoint.MessageProducerSupportprotected java.util.Collection<javax.management.ObjectName> retrieveMBeanNames()