@ManagedResource @IntegrationManagedResource public class IntegrationMBeanExporter extends MBeanExporter implements ApplicationContextAware, EmbeddedValueResolverAware
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).
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_DOMAIN |
AUTODETECT_ALL, AUTODETECT_ASSEMBLER, AUTODETECT_MBEAN, AUTODETECT_NONEREGISTRATION_FAIL_ON_EXISTING, REGISTRATION_IGNORE_EXISTING, REGISTRATION_REPLACE_EXISTING, server| Constructor and Description |
|---|
IntegrationMBeanExporter() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterSingletonsInstantiated() |
void |
destroy() |
int |
getActiveHandlerCount() |
long |
getActiveHandlerCountLong() |
int |
getChannelCount() |
Statistics |
getChannelErrorRate(String name) |
MessageChannelMetrics |
getChannelMetrics(String name) |
String[] |
getChannelNames() |
int |
getChannelReceiveCount(String name) |
long |
getChannelReceiveCountLong(String name) |
int |
getChannelSendCount(String name) |
long |
getChannelSendCountLong(String name) |
int |
getChannelSendErrorCount(String name) |
long |
getChannelSendErrorCountLong(String name) |
Statistics |
getChannelSendRate(String name) |
int |
getHandlerCount() |
Statistics |
getHandlerDuration(String name) |
MessageHandlerMetrics |
getHandlerMetrics(String name) |
String[] |
getHandlerNames() |
int |
getQueuedMessageCount() |
int |
getSourceMessageCount(String name) |
long |
getSourceMessageCountLong(String name) |
MessageSourceMetrics |
getSourceMetrics(String name) |
protected void |
orderlyShutdownCapableComponentsAfter() |
protected void |
orderlyShutdownCapableComponentsBefore() |
void |
setApplicationContext(ApplicationContext applicationContext) |
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 |
setEmbeddedValueResolver(StringValueResolver resolver) |
void |
setEnabledCountsPatterns(String[] enabledCountsPatterns)
Set the array of simple patterns for component names for which message counts will
be enabled (defaults to '*').
|
void |
setEnabledStatsPatterns(String[] enabledStatsPatterns)
Set the array of simple patterns for component names for which message statistics
will be enabled (response times, rates etc), as well as counts (a positive match
here overrides
enabledCountsPatterns,
you can't have statistics without counts). |
void |
setMetricsFactory(MetricsFactory metricsFactory)
Set a metrics factory.
|
void |
setObjectNameStaticProperties(Map<String,String> objectNameStaticProperties)
Static properties that will be added to all object names.
|
void |
stopActiveChannels() |
void |
stopActiveComponents(long howLong)
Shutdown active components.
|
void |
stopInboundMessageProducers()
Stops all inbound message producers (that are not
OrderlyShutdownCapable)
- may cause interrupts. |
void |
stopMessageSources()
Stops all message sources - may cause interrupts.
|
adaptMBeanIfPossible, addExcludedBean, afterPropertiesSet, createAndConfigureMBean, createModelMBean, getObjectName, isBeanDefinitionLazyInit, isMBean, onRegister, onUnregister, registerBeanNameOrInstance, registerBeans, registerManagedResource, registerManagedResource, setAllowEagerInit, setAssembler, setAutodetect, setAutodetectMode, setAutodetectModeName, setBeanClassLoader, setBeanFactory, setBeans, setEnsureUniqueRuntimeObjectNames, setExcludedBeans, setExposeManagedResourceClassLoader, setListeners, setNamingStrategy, setNotificationListenerMappings, setNotificationListeners, unregisterManagedResourcedoRegister, doUnregister, getRegisteredObjectNames, getServer, onRegister, setRegistrationBehavior, setRegistrationBehaviorName, setRegistrationPolicy, setServer, unregisterBeanspublic static final String DEFAULT_DOMAIN
public void setObjectNameStaticProperties(Map<String,String> objectNameStaticProperties)
objectNameStaticProperties - the objectNameStaticProperties to setpublic void setDefaultDomain(String domain)
spring.application (which is useful in
SpringSource HQ).domain - the domain name to setpublic void setComponentNamePatterns(String[] componentNamePatterns)
componentNamePatterns - the patterns.public void setEnabledCountsPatterns(String[] enabledCountsPatterns)
componentNamePatterns will be
considered. Enables message counting (`sendCount`, `errorCount`, `receiveCount`)
for those components that support counters (channels, message handlers, etc).
This is the initial setting only, individual components can have counts
enabled/disabled at runtime. May be overridden by an entry in
enabledStatsPatterns which is additional
functionality over simple counts. If a pattern starts with `!`, counts are disabled
for matches. For components that match multiple patterns, the first pattern wins.
Disabling counts at runtime also disables stats.enabledCountsPatterns - the patterns.public void setEnabledStatsPatterns(String[] enabledStatsPatterns)
enabledCountsPatterns,
you can't have statistics without counts). (defaults to '*'). Only patterns that
also match componentNamePatterns will
be considered. Enables statistics for those components that support statistics
(channels - when sending, message handlers, etc). This is the initial setting only,
individual components can have stats enabled/disabled at runtime. If a pattern
starts with `!`, stats (and counts) are disabled for matches. Note: this means that
'!foo' here will disable stats and counts for 'foo' even if counts are enabled for
'foo' in enabledCountsPatterns. For
components that match multiple patterns, the first pattern wins. Enabling stats at
runtime also enables counts.enabledStatsPatterns - the patterns.public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext in interface ApplicationContextAwareBeansExceptionpublic void setEmbeddedValueResolver(StringValueResolver resolver)
setEmbeddedValueResolver in interface EmbeddedValueResolverAwarepublic void setMetricsFactory(MetricsFactory metricsFactory)
metricsFactory - the factory.public void afterSingletonsInstantiated()
afterSingletonsInstantiated in interface SmartInitializingSingletonafterSingletonsInstantiated in class MBeanExporterpublic void destroy()
destroy in interface DisposableBeandestroy in class MBeanExporter@ManagedOperation public void stopActiveComponents(long howLong)
howLong - The time to wait in total for all activities to complete
in milliseconds.@ManagedOperation public void stopMessageSources()
@ManagedOperation public void stopInboundMessageProducers()
OrderlyShutdownCapable)
- may cause interrupts.@ManagedOperation public void stopActiveChannels()
protected final void orderlyShutdownCapableComponentsBefore()
protected final void orderlyShutdownCapableComponentsAfter()
@ManagedMetric(metricType=COUNTER, displayName="MessageChannel Channel Count") public int getChannelCount()
@ManagedMetric(metricType=COUNTER, displayName="MessageHandler Handler Count") public int getHandlerCount()
@ManagedAttribute public String[] getHandlerNames()
@ManagedMetric(metricType=GAUGE, displayName="Active Handler Count") public int getActiveHandlerCount()
@ManagedMetric(metricType=GAUGE, displayName="Active Handler Count") public long getActiveHandlerCountLong()
@ManagedMetric(metricType=GAUGE, displayName="Queued Message Count") public int getQueuedMessageCount()
@ManagedAttribute public String[] getChannelNames()
public MessageHandlerMetrics getHandlerMetrics(String name)
public Statistics getHandlerDuration(String name)
public MessageSourceMetrics getSourceMetrics(String name)
public int getSourceMessageCount(String name)
public long getSourceMessageCountLong(String name)
public MessageChannelMetrics getChannelMetrics(String name)
public int getChannelSendCount(String name)
public long getChannelSendCountLong(String name)
public int getChannelSendErrorCount(String name)
public long getChannelSendErrorCountLong(String name)
public int getChannelReceiveCount(String name)
public long getChannelReceiveCountLong(String name)
@ManagedOperation public Statistics getChannelSendRate(String name)
public Statistics getChannelErrorRate(String name)