Spring Integration

org.springframework.integration.monitor
Class IntegrationMBeanExporter

java.lang.Object
  extended by org.springframework.jmx.support.MBeanRegistrationSupport
      extended by org.springframework.jmx.export.MBeanExporter
          extended by org.springframework.integration.monitor.IntegrationMBeanExporter
All Implemented Interfaces:
org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.jmx.export.MBeanExportOperations

@ManagedResource
public class IntegrationMBeanExporter
extends org.springframework.jmx.export.MBeanExporter
implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.context.SmartLifecycle

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

Field Summary
static java.lang.String DEFAULT_DOMAIN
           
 
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
registeredBeans, REGISTRATION_FAIL_ON_EXISTING, REGISTRATION_IGNORE_EXISTING, REGISTRATION_REPLACE_EXISTING, server
 
Constructor Summary
IntegrationMBeanExporter()
           
 
Method Summary
 void destroy()
           
protected  void doStart()
           
protected  void doStop()
           
 int getActiveHandlerCount()
           
 int getChannelCount()
           
 Statistics getChannelErrorRate(java.lang.String name)
           
 java.lang.String[] getChannelNames()
           
 int getChannelReceiveCount(java.lang.String name)
           
 Statistics getChannelSendRate(java.lang.String name)
           
 int getHandlerCount()
           
 Statistics getHandlerDuration(java.lang.String name)
           
 java.lang.String[] getHandlerNames()
           
 int getPhase()
           
 int getQueuedMessageCount()
           
 int getSourceMessageCount(java.lang.String name)
           
 boolean isAutoStartup()
           
 boolean isRunning()
           
 java.lang.Object postProcessAfterInitialization(java.lang.Object bean, java.lang.String beanName)
           
 java.lang.Object postProcessBeforeInitialization(java.lang.Object bean, java.lang.String beanName)
           
protected  void registerBeans()
           
 void setBeanClassLoader(java.lang.ClassLoader classLoader)
           
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 void setComponentNamePatterns(java.lang.String[] componentNamePatterns)
           
 void setDefaultDomain(java.lang.String domain)
          The JMX domain to use for MBeans registered.
 void setObjectNameStaticProperties(java.util.Map<java.lang.String,java.lang.String> objectNameStaticProperties)
          Static properties that will be added to all object names.
 void start()
           
 void stop()
           
 void stop(java.lang.Runnable callback)
           
 
Methods inherited from class org.springframework.jmx.export.MBeanExporter
adaptMBeanIfPossible, afterPropertiesSet, createAndConfigureMBean, createModelMBean, getObjectName, isBeanDefinitionLazyInit, isMBean, onRegister, onUnregister, registerBeanNameOrInstance, registerManagedResource, registerManagedResource, setAllowEagerInit, setAssembler, setAutodetect, setAutodetectMode, setAutodetectModeName, setBeans, setEnsureUniqueRuntimeObjectNames, setExcludedBeans, setExposeManagedResourceClassLoader, setListeners, setNamingStrategy, setNotificationListenerMappings, setNotificationListeners, unregisterManagedResource
 
Methods inherited from class org.springframework.jmx.support.MBeanRegistrationSupport
doRegister, doUnregister, getRegisteredObjectNames, getServer, onRegister, setRegistrationBehavior, setRegistrationBehaviorName, setServer, unregisterBeans
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DOMAIN

public static final java.lang.String DEFAULT_DOMAIN
See Also:
Constant Field Values
Constructor Detail

IntegrationMBeanExporter

public IntegrationMBeanExporter()
Method Detail

setBeanClassLoader

public void setBeanClassLoader(java.lang.ClassLoader classLoader)
Specified by:
setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAware
Overrides:
setBeanClassLoader in class org.springframework.jmx.export.MBeanExporter

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 to spring.application (which is useful in SpringSource HQ).

Parameters:
domain - the domain name to set

setComponentNamePatterns

public void setComponentNamePatterns(java.lang.String[] componentNamePatterns)

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
                    throws org.springframework.beans.BeansException
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Overrides:
setBeanFactory in class org.springframework.jmx.export.MBeanExporter
Throws:
org.springframework.beans.BeansException

postProcessAfterInitialization

public java.lang.Object postProcessAfterInitialization(java.lang.Object bean,
                                                       java.lang.String beanName)
                                                throws org.springframework.beans.BeansException
Specified by:
postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
Throws:
org.springframework.beans.BeansException

postProcessBeforeInitialization

public java.lang.Object postProcessBeforeInitialization(java.lang.Object bean,
                                                        java.lang.String beanName)
                                                 throws org.springframework.beans.BeansException
Specified by:
postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
Throws:
org.springframework.beans.BeansException

isAutoStartup

public final boolean isAutoStartup()
Specified by:
isAutoStartup in interface org.springframework.context.SmartLifecycle

getPhase

public final int getPhase()
Specified by:
getPhase in interface org.springframework.context.Phased

isRunning

public final boolean isRunning()
Specified by:
isRunning in interface org.springframework.context.Lifecycle

start

public final void start()
Specified by:
start in interface org.springframework.context.Lifecycle

stop

public final void stop()
Specified by:
stop in interface org.springframework.context.Lifecycle

stop

public final void stop(java.lang.Runnable callback)
Specified by:
stop in interface org.springframework.context.SmartLifecycle

doStop

protected void doStop()

doStart

protected void doStart()

destroy

public void destroy()
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Overrides:
destroy in class org.springframework.jmx.export.MBeanExporter

getChannelCount

@ManagedMetric(metricType=COUNTER,
               displayName="MessageChannel Channel Count")
public int getChannelCount()

getHandlerCount

@ManagedMetric(metricType=COUNTER,
               displayName="MessageHandler Handler Count")
public int getHandlerCount()

getHandlerNames

@ManagedAttribute
public java.lang.String[] getHandlerNames()

getActiveHandlerCount

@ManagedMetric(metricType=GAUGE,
               displayName="Active Handler Count")
public int getActiveHandlerCount()

getQueuedMessageCount

@ManagedMetric(metricType=GAUGE,
               displayName="Queued Message Count")
public int getQueuedMessageCount()

getChannelNames

@ManagedAttribute
public java.lang.String[] getChannelNames()

getHandlerDuration

public Statistics getHandlerDuration(java.lang.String name)

getSourceMessageCount

public int getSourceMessageCount(java.lang.String name)

getChannelReceiveCount

public int getChannelReceiveCount(java.lang.String name)

getChannelSendRate

@ManagedOperation
public Statistics getChannelSendRate(java.lang.String name)

getChannelErrorRate

public Statistics getChannelErrorRate(java.lang.String name)

registerBeans

protected void registerBeans()
Overrides:
registerBeans in class org.springframework.jmx.export.MBeanExporter

Spring Integration