public class NotificationListeningMessageProducer extends MessageProducerSupport implements NotificationListener, ApplicationListener<ContextRefreshedEvent>
NotificationListener implementation that will send Messages
containing the JMX Notification instances as their payloads.lifecycleCondition, lifecycleLockEXPRESSION_PARSERDEFAULT_PHASE| 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.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
void |
handleNotification(Notification notification,
Object handback)
Notification handling method implementation.
|
void |
onApplicationEvent(ContextRefreshedEvent event)
The
NotificationListener might not be registered on AbstractEndpoint.start()
because the MBeanExporter might not been started yet. |
protected Collection<ObjectName> |
retrieveMBeanNames() |
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... objectNames)
Specify the JMX ObjectNames (or patterns)
of the notification publisher
to which this notification listener should be subscribed.
|
void |
setServer(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, start, stop, stopafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBeanName, getComponentNamepublic NotificationListeningMessageProducer()
public void setServer(MBeanServerConnection server)
server - the MBean server connection.public void setObjectName(ObjectName... objectNames)
objectNames - The object names.public void setFilter(NotificationFilter filter)
NotificationFilter to be passed to the server
when registering this listener. The filter may be null.filter - The filter.public void setHandback(Object handback)
handback - The object.public void handleNotification(Notification notification, 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 NotificationListenerpublic String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class IntegrationObjectSupportpublic void onApplicationEvent(ContextRefreshedEvent event)
NotificationListener might not be registered on AbstractEndpoint.start()
because the MBeanExporter might not been started yet.onApplicationEvent in interface ApplicationListener<ContextRefreshedEvent>event - the ContextRefreshedEvent eventprotected void doStart()
doStart in class MessageProducerSupportprotected void doStop()
doStop in class MessageProducerSupportprotected Collection<ObjectName> retrieveMBeanNames()