Class IntegrationMBeanExporter
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,BeanPostProcessor
,DestructionAwareBeanPostProcessor
,DisposableBean
,InitializingBean
,SmartInitializingSingleton
,ApplicationContextAware
,MBeanExportOperations
MBean exporter for Spring Integration components in an existing application. Add an instance of this as a bean definition in the same context as the components you need to monitor and all message channels and message handlers will be exposed.
Channels will report metrics on send and receive (counts, rates, errors) and handlers will report metrics on
execution duration. Channels will be registered under their name (bean id), if explicit, or the last part of their
internal name (e.g. "nullChannel") if registered by the framework. A handler that is attached to an endpoint will be
registered with the endpoint name (bean id) if there is one, otherwise under the name of the input channel. Handler
object names contain a bean
key that reports the source of the name: "endpoint" if the name is the
endpoint id; "anonymous" if it is the input channel; and "handler" as a fallback, where the object name is just the
toString()
of the handler.
This component is itself an MBean, reporting attributes concerning the names and object names of the channels and
handlers. It doesn't register itself to avoid conflicts with the standard <context:mbean-export/>
from Spring (which should therefore be used any time you need to expose those features).
- Author:
- Dave Syer, Helena Edelson, Oleg Zhurakousky, Gary Russell, Artem Bilan, Meherzad Lahewala
-
Field Summary
Fields inherited from class org.springframework.jmx.export.MBeanExporter
AUTODETECT_ALL, AUTODETECT_ASSEMBLER, AUTODETECT_MBEAN, AUTODETECT_NONE
Fields inherited from class org.springframework.jmx.support.MBeanRegistrationSupport
logger, server
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
getChannel
(String name) int
String[]
getHandler
(String name) int
String[]
int
int
String[]
protected final void
protected final void
postProcessAfterInitialization
(Object bean, String beanName) void
postProcessBeforeDestruction
(Object bean, String beanName) boolean
requiresDestruction
(Object bean) void
setApplicationContext
(ApplicationContext applicationContext) void
setBeanFactory
(BeanFactory beanFactory) void
setComponentNamePatterns
(String[] componentNamePatterns) Set the array of simple patterns for component names to register (defaults to '*').void
setDefaultDomain
(String domain) The JMX domain to use for MBeans registered.void
setObjectNameStaticProperties
(Map<String, String> objectNameStaticProperties) Static properties that will be added to all object names.void
void
stopActiveComponents
(long howLong) Shutdown active components.void
Stops all inbound message producers (that are notOrderlyShutdownCapable
) - may cause interrupts.void
Stops all message sources - may cause interrupts.Methods inherited from class org.springframework.jmx.export.MBeanExporter
adaptMBeanIfPossible, addExcludedBean, createAndConfigureMBean, createModelMBean, destroy, getObjectName, isBeanDefinitionLazyInit, isMBean, onRegister, onUnregister, registerBeanNameOrInstance, registerBeans, registerManagedResource, registerManagedResource, setAllowEagerInit, setAssembler, setAutodetect, setAutodetectMode, setAutodetectModeName, setBeanClassLoader, setBeans, setEnsureUniqueRuntimeObjectNames, setExcludedBeans, setExposeManagedResourceClassLoader, setListeners, setNamingStrategy, setNotificationListenerMappings, setNotificationListeners, unregisterManagedResource
Methods inherited from class org.springframework.jmx.support.MBeanRegistrationSupport
doRegister, doUnregister, getRegisteredObjectNames, getServer, onRegister, setRegistrationPolicy, setServer, unregisterBeans
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor
postProcessBeforeInitialization
-
Field Details
-
DEFAULT_DOMAIN
- See Also:
-
-
Constructor Details
-
IntegrationMBeanExporter
public IntegrationMBeanExporter()
-
-
Method Details
-
setObjectNameStaticProperties
Static properties that will be added to all object names.- Parameters:
objectNameStaticProperties
- the objectNameStaticProperties to set
-
setDefaultDomain
The JMX domain to use for MBeans registered. Defaults tospring.application
(which is useful in SpringSource HQ).- Parameters:
domain
- the domain name to set
-
setComponentNamePatterns
Set the array of simple patterns for component names to register (defaults to '*'). The pattern is applied to all components before they are registered, looking for a match on the 'name' property of the ObjectName. A MessageChannel and a MessageHandler (for instance) can share a name because they have a different type, so in that case they would either both be included or both excluded. Since version 4.2, a leading '!' negates the pattern match ('!foo*' means don't export components where the name matches the pattern 'foo*'). For components with names that match multiple patterns, the first pattern wins.- Parameters:
componentNamePatterns
- the patterns.
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
setBeanFactory
- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Overrides:
setBeanFactory
in classMBeanExporter
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Overrides:
afterPropertiesSet
in classMBeanExporter
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiated
in interfaceSmartInitializingSingleton
- Overrides:
afterSingletonsInstantiated
in classMBeanExporter
-
postProcessAfterInitialization
- Specified by:
postProcessAfterInitialization
in interfaceBeanPostProcessor
- Throws:
BeansException
-
requiresDestruction
- Specified by:
requiresDestruction
in interfaceDestructionAwareBeanPostProcessor
-
postProcessBeforeDestruction
- Specified by:
postProcessBeforeDestruction
in interfaceDestructionAwareBeanPostProcessor
- Throws:
BeansException
-
stopActiveComponents
Shutdown active components.- Parameters:
howLong
- The time to wait in total for all activities to complete in milliseconds.
-
stopMessageSources
Stops all message sources - may cause interrupts. -
stopInboundMessageProducers
Stops all inbound message producers (that are notOrderlyShutdownCapable
) - may cause interrupts. -
stopActiveChannels
-
orderlyShutdownCapableComponentsBefore
protected final void orderlyShutdownCapableComponentsBefore() -
orderlyShutdownCapableComponentsAfter
protected final void orderlyShutdownCapableComponentsAfter() -
getChannelCount
-
getHandlerCount
-
getSourceCount
-
getHandlerNames
-
getQueuedMessageCount
@ManagedMetric(metricType=GAUGE, displayName="Queued Message Count") public int getQueuedMessageCount() -
getChannelNames
-
getHandler
-
getSourceNames
-
getSource
-
getChannel
-