From 008bc8522ba0b8f70640120a7659139deaf2171f Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Thu, 31 Oct 2013 15:29:31 -0400 Subject: [PATCH] INT-3183 Document the IMBE 'id' Attribute When declaring an IntegrationMBeanExporter, use an 'id' attribute if you wish to obtain programmatic access to it (using injection or referencing the BeanFactory. JIRA: https://jira.springsource.org/browse/INT-3183 Also turn off debug logging for JMX test cases. --- .../src/test/java/log4j.properties | 4 ++-- src/reference/docbook/jmx.xml | 23 +++++++++++-------- src/reference/docbook/shutdown.xml | 18 +++++++++++++++ 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/spring-integration-jmx/src/test/java/log4j.properties b/spring-integration-jmx/src/test/java/log4j.properties index 9246efaccb..0c503ac468 100644 --- a/spring-integration-jmx/src/test/java/log4j.properties +++ b/spring-integration-jmx/src/test/java/log4j.properties @@ -6,6 +6,6 @@ log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m log4j.category.org.springframework=WARN -log4j.category.org.springframework.integration=DEBUG -log4j.category.org.springframework.beans.factory=DEBUG +#log4j.category.org.springframework.integration=DEBUG +#log4j.category.org.springframework.beans.factory=DEBUG #log4j.category.org.springframework.integration.monitor=TRACE diff --git a/src/reference/docbook/jmx.xml b/src/reference/docbook/jmx.xml index b41b366eda..20ef093cc1 100644 --- a/src/reference/docbook/jmx.xml +++ b/src/reference/docbook/jmx.xml @@ -81,7 +81,7 @@ relatively simple. It only requires a JMX ObjectName in its configuration as shown below. - + default-notification-type attribute provided in the configuration. - + org.springframework.integration. - + @@ -250,7 +251,7 @@ Once the exporter is defined, start up your application with: - -Dcom.sun.management.jmxremote + -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=6969 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false @@ -262,16 +263,20 @@ sophisticated features than JConsole.) - + + The MBean exporter is orthogonal to the one provided in Spring core - it registers message channels and message handlers, but not itself. You can expose the exporter itself, and certain other components in Spring Integration, using the standard <context:mbean-export/> - tag. The exporter has a couple of useful metrics attached to it, for + tag. The exporter has a some metrics attached to it, for instance a count of the number of active handlers and the number of - queued messages (these would both be important if you wanted to - shutdown the context without losing any messages). - + queued messages. + + + It also has a useful operation, as discussed in . + +
MBean ObjectNames diff --git a/src/reference/docbook/shutdown.xml b/src/reference/docbook/shutdown.xml index 4ebeb1ecde..21c76edddb 100644 --- a/src/reference/docbook/shutdown.xml +++ b/src/reference/docbook/shutdown.xml @@ -58,4 +58,22 @@ If no time is left when we get to step 6, it probably means some thread is hung; in which case, the operation attempts a forced shutdown on all schedulers and executors before exiting. + + As discussed in this operation can be invoked using JMX. If you + wish to programmatically invoke the method, you will need to inject, or otherwise get a reference to, + the IntegrationMBeanExporter. If no id attribute is provided on + the <int-jmx:mbean-export/> definition, the bean will have a generated name. This + name contains a random component to avoid ObjectName collisions if multiple + Spring Integration contexts exist in the same JVM (MBeanServer). + + + For this reason, if you wish to invoke the method programmatically, it is recommended that you + provide the exporter with an id attribute so it can easily be accessed in the + application context. + + + Finally, the operation can be invoked using the <control-bus>; see the + monitoring Spring Integration sample application for details. +