Class IntegrationMBeanExporter
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.config.BeanPostProcessor,org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.beans.factory.SmartInitializingSingleton,org.springframework.context.ApplicationContextAware,org.springframework.jmx.export.MBeanExportOperations
@ManagedResource
public class IntegrationMBeanExporter
extends org.springframework.jmx.export.MBeanExporter
implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor
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).
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_DOMAIN -
Constructor Summary
Constructors Constructor Description IntegrationMBeanExporter() -
Method Summary
Modifier and Type Method Description voidafterSingletonsInstantiated()intgetActiveHandlerCount()Deprecated.longgetActiveHandlerCountLong()Deprecated.org.springframework.integration.support.management.IntegrationManagementgetChannel(java.lang.String name)intgetChannelCount()org.springframework.integration.support.management.IntegrationManagementgetChannelMetrics(java.lang.String name)Deprecated.java.lang.String[]getChannelNames()org.springframework.integration.support.management.IntegrationManagementgetHandler(java.lang.String name)intgetHandlerCount()org.springframework.integration.handler.AbstractMessageHandlergetHandlerMetrics(java.lang.String name)Deprecated.java.lang.String[]getHandlerNames()intgetQueuedMessageCount()org.springframework.integration.support.management.IntegrationInboundManagementgetSource(java.lang.String name)intgetSourceCount()org.springframework.integration.support.management.IntegrationInboundManagementgetSourceMetrics(java.lang.String name)Deprecated.java.lang.String[]getSourceNames()protected voidorderlyShutdownCapableComponentsAfter()protected voidorderlyShutdownCapableComponentsBefore()java.lang.ObjectpostProcessAfterInitialization(java.lang.Object bean, java.lang.String beanName)voidpostProcessBeforeDestruction(java.lang.Object bean, java.lang.String beanName)booleanrequiresDestruction(java.lang.Object bean)voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)voidsetComponentNamePatterns(java.lang.String[] componentNamePatterns)Set the array of simple patterns for component names to register (defaults to '*').voidsetDefaultDomain(java.lang.String domain)The JMX domain to use for MBeans registered.voidsetObjectNameStaticProperties(java.util.Map<java.lang.String,java.lang.String> objectNameStaticProperties)Static properties that will be added to all object names.voidstopActiveChannels()voidstopActiveComponents(long howLong)Shutdown active components.voidstopInboundMessageProducers()Stops all inbound message producers (that are notOrderlyShutdownCapable) - may cause interrupts.voidstopMessageSources()Stops all message sources - may cause interrupts.Methods inherited from class org.springframework.jmx.export.MBeanExporter
adaptMBeanIfPossible, addExcludedBean, afterPropertiesSet, 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, unregisterManagedResourceMethods inherited from class org.springframework.jmx.support.MBeanRegistrationSupport
doRegister, doUnregister, getRegisteredObjectNames, getServer, onRegister, setRegistrationPolicy, setServer, unregisterBeans
-
Field Details
-
DEFAULT_DOMAIN
public static final java.lang.String DEFAULT_DOMAIN- See Also:
- Constant Field Values
-
-
Constructor Details
-
IntegrationMBeanExporter
public IntegrationMBeanExporter()
-
-
Method Details
-
setObjectNameStaticProperties
public void setObjectNameStaticProperties(java.util.Map<java.lang.String,java.lang.String> objectNameStaticProperties)Static properties that will be added to all object names.- Parameters:
objectNameStaticProperties- the objectNameStaticProperties to set
-
setDefaultDomain
public void setDefaultDomain(java.lang.String domain)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
public void setComponentNamePatterns(java.lang.String[] componentNamePatterns)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
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)- Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Overrides:
setBeanFactoryin classorg.springframework.jmx.export.MBeanExporter
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiatedin interfaceorg.springframework.beans.factory.SmartInitializingSingleton- Overrides:
afterSingletonsInstantiatedin classorg.springframework.jmx.export.MBeanExporter
-
postProcessAfterInitialization
public java.lang.Object postProcessAfterInitialization(java.lang.Object bean, java.lang.String beanName) throws org.springframework.beans.BeansException- Specified by:
postProcessAfterInitializationin interfaceorg.springframework.beans.factory.config.BeanPostProcessor- Throws:
org.springframework.beans.BeansException
-
requiresDestruction
public boolean requiresDestruction(java.lang.Object bean)- Specified by:
requiresDestructionin interfaceorg.springframework.beans.factory.config.DestructionAwareBeanPostProcessor
-
postProcessBeforeDestruction
public void postProcessBeforeDestruction(java.lang.Object bean, java.lang.String beanName) throws org.springframework.beans.BeansException- Specified by:
postProcessBeforeDestructionin interfaceorg.springframework.beans.factory.config.DestructionAwareBeanPostProcessor- Throws:
org.springframework.beans.BeansException
-
stopActiveComponents
@ManagedOperation public void stopActiveComponents(long howLong)Shutdown active components.- Parameters:
howLong- The time to wait in total for all activities to complete in milliseconds.
-
stopMessageSources
@ManagedOperation public void stopMessageSources()Stops all message sources - may cause interrupts. -
stopInboundMessageProducers
@ManagedOperation public void stopInboundMessageProducers()Stops all inbound message producers (that are notOrderlyShutdownCapable) - may cause interrupts. -
stopActiveChannels
@ManagedOperation public void stopActiveChannels() -
orderlyShutdownCapableComponentsBefore
protected final void orderlyShutdownCapableComponentsBefore() -
orderlyShutdownCapableComponentsAfter
protected final void orderlyShutdownCapableComponentsAfter() -
getChannelCount
@ManagedMetric(metricType=COUNTER, displayName="MessageChannel Count") public int getChannelCount() -
getHandlerCount
@ManagedMetric(metricType=COUNTER, displayName="MessageHandler Count") public int getHandlerCount() -
getSourceCount
@ManagedMetric(metricType=COUNTER, displayName="MessageSource Count") public int getSourceCount() -
getHandlerNames
@ManagedAttribute public java.lang.String[] getHandlerNames() -
getActiveHandlerCount
@Deprecated @ManagedMetric(metricType=GAUGE, displayName="No longer supported") public int getActiveHandlerCount()Deprecated. -
getActiveHandlerCountLong
@Deprecated @ManagedMetric(metricType=GAUGE, displayName="No longer supported") public long getActiveHandlerCountLong()Deprecated. -
getQueuedMessageCount
@ManagedMetric(metricType=GAUGE, displayName="Queued Message Count") public int getQueuedMessageCount() -
getChannelNames
@ManagedAttribute public java.lang.String[] getChannelNames() -
getHandlerMetrics
@Nullable @Deprecated public org.springframework.integration.handler.AbstractMessageHandler getHandlerMetrics(java.lang.String name)Deprecated. -
getHandler
@Nullable public org.springframework.integration.support.management.IntegrationManagement getHandler(java.lang.String name) -
getSourceNames
@ManagedAttribute public java.lang.String[] getSourceNames() -
getSourceMetrics
@Deprecated public org.springframework.integration.support.management.IntegrationInboundManagement getSourceMetrics(java.lang.String name)Deprecated. -
getChannelMetrics
@Deprecated public org.springframework.integration.support.management.IntegrationManagement getChannelMetrics(java.lang.String name)Deprecated. -
getSource
public org.springframework.integration.support.management.IntegrationInboundManagement getSource(java.lang.String name) -
getChannel
public org.springframework.integration.support.management.IntegrationManagement getChannel(java.lang.String name)
-