INT-1420: add docs for control bus and tidy JMX
This commit is contained in:
35
docs/src/reference/docbook/control-bus.xml
Normal file
35
docs/src/reference/docbook/control-bus.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section version="5.0" xml:id="jmx" xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:ns5="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ns4="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:ns3="http://www.w3.org/2000/svg"
|
||||
xmlns:ns="http://docbook.org/ns/docbook">
|
||||
<title>Control Bus</title>
|
||||
|
||||
<para>As described in (EIP), the idea behind the Control Bus is that
|
||||
the same messaging system can be used for monitoring and managing
|
||||
the components within the framework as is used for
|
||||
"application-level" messaging. In Spring Integration we build upon
|
||||
the adapters described above so that it's possible to send Messages
|
||||
as a means of invoking exposed operations.</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<groovy:control-bus input-channel="operationChannel"/></programlisting>
|
||||
|
||||
<para>The Control Bus has an input channel that can be accessed for
|
||||
invoking operations on the beans in the application context. It
|
||||
also has all the common properties of a service activating endpoint,
|
||||
e.g. you can specify an output channel if the result of the
|
||||
operation has a return value that you want to send on to a
|
||||
downsatrem channel.
|
||||
</para>
|
||||
|
||||
<para>The Control Bus executes messages on the input channel as
|
||||
Spring Expression Language expressions. It takes a message,
|
||||
compiles the body to an expression, adds some context, and then
|
||||
executes it. The default context just exposes all the beans in the
|
||||
application context by name.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
@@ -1,30 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="groovy"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<section version="5.0" xml:id="groovy" xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:ns5="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ns4="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:ns3="http://www.w3.org/2000/svg"
|
||||
xmlns:ns="http://docbook.org/ns/docbook">
|
||||
<title>Groovy support</title>
|
||||
<para>
|
||||
With Spring Integration 2.0 we've added Groovy support allowing you to use Groovy scripting language to provide
|
||||
integration and business logic for various integration components similar to the way Spring Expression Language (SpEL)
|
||||
is use to implement routing, transformation and other integration concerns.
|
||||
|
||||
For more information about Groovy please refer to Groovy documentation which you can find here: http://groovy.codehaus.org/
|
||||
</para>
|
||||
<para>With Spring Integration 2.0 we've added Groovy support allowing you to
|
||||
use Groovy scripting language to provide integration and business logic for
|
||||
various integration components similar to the way Spring Expression Language
|
||||
(SpEL) is use to implement routing, transformation and other integration
|
||||
concerns. For more information about Groovy please refer to Groovy
|
||||
documentation which you can find
|
||||
on the <ulink url="http://groovy.codehaus.org">project website</ulink></para>
|
||||
|
||||
<section id="groovy-config">
|
||||
<title>Groovy configuration</title>
|
||||
<para>
|
||||
Depending on the complexity of your integration requirements Groovy scripts could be provided inline as CDATA in XML
|
||||
configuration or as a reference to a file containing Groovy script.
|
||||
|
||||
To enable Groovy support Spring Integration defines <classname>GroovyScriptExecutingMessageProcessor</classname> which will
|
||||
create a groovy Binding object identifying Message Payload as <code>payload</code> variable and Message Headers as
|
||||
<code>headers</code> variable. All that is left for you to do is write script that uses these variables.
|
||||
Below are couple of sample configurations:
|
||||
</para>
|
||||
<para>Depending on the complexity of your integration requirements Groovy
|
||||
scripts could be provided inline as CDATA in XML configuration or as a
|
||||
reference to a file containing Groovy script. To enable Groovy support
|
||||
Spring Integration defines
|
||||
<classname>GroovyScriptExecutingMessageProcessor</classname> which will
|
||||
create a groovy Binding object identifying Message Payload as
|
||||
<code>payload</code> variable and Message Headers as <code>headers</code>
|
||||
variable. All that is left for you to do is write script that uses these
|
||||
variables. Below are couple of sample configurations:</para>
|
||||
|
||||
<para>
|
||||
<emphasis>Filter</emphasis>
|
||||
<programlisting language="xml"><filter input-channel="referencedScriptInput">
|
||||
<para><emphasis>Filter</emphasis> <programlisting language="xml"><filter input-channel="referencedScriptInput">
|
||||
<groovy:script location="some/path/to/groovy/file/GroovyFilterTests.groovy"/>
|
||||
</filter>
|
||||
|
||||
@@ -32,41 +36,50 @@
|
||||
<groovy:script><![CDATA[
|
||||
return payload == 'good'
|
||||
]]></groovy:script>
|
||||
</filter></programlisting>
|
||||
You see that script could be included inline or via <code>location</code> attribute using the groovy namespace sport.
|
||||
</para>
|
||||
</filter></programlisting> You see that script could be included inline
|
||||
or via <code>location</code> attribute using the groovy namespace
|
||||
sport. </para>
|
||||
|
||||
<para>
|
||||
Other supported elements are <emphasis>router, service-activator, transformer, splitter</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Another interesting aspect of using Groovy support is framework's ability to update (reload) scripts
|
||||
without restarting the Application Context.
|
||||
To accomplish this all you need is specify <code>refresh-check-delay</code> attribute on <emphasis>script</emphasis>
|
||||
element. The reason for this attribute is to make reloading of the script more efficient.
|
||||
|
||||
<programlisting language="xml"><![CDATA[<groovy:script location="..." refresh-check-delay="5000"/>]]></programlisting>
|
||||
|
||||
In the above example for the next 5 seconds after you update the script you'll still be using the old script and
|
||||
after 5 seconds the context will be updated with the new script. This is a good example where 'near real time'
|
||||
is acceptable.
|
||||
|
||||
<programlisting language="xml"><![CDATA[<groovy:script location="..." refresh-check-delay="0"/>]]></programlisting>
|
||||
|
||||
In the above example the context will be updated with the new script every time the script is modified. Basically this is the example of the
|
||||
'real-time' and might not be the most efficient way.
|
||||
|
||||
<programlisting language="xml"><![CDATA[<groovy:script location="..." refresh-check-delay="-1"/>]]></programlisting>
|
||||
|
||||
|
||||
Any negative number value means the script will never be refreshed after initial initialization of application context.
|
||||
DEFAULT BEHAVIOR
|
||||
|
||||
<important>Inline defined script can not be reloaded.</important>
|
||||
|
||||
</para>
|
||||
<para>Other supported elements are <emphasis>router, service-activator,
|
||||
transformer, splitter</emphasis></para>
|
||||
|
||||
<para>Another interesting aspect of using Groovy support is framework's
|
||||
ability to update (reload) scripts without restarting the Application
|
||||
Context. To accomplish this all you need is specify
|
||||
<code>refresh-check-delay</code> attribute on <emphasis>script</emphasis>
|
||||
element. The reason for this attribute is to make reloading of the script
|
||||
more efficient. <programlisting language="xml"><groovy:script location="..." refresh-check-delay="5000"/></programlisting>
|
||||
In the above example for the next 5 seconds after you update the script
|
||||
you'll still be using the old script and after 5 seconds the context will
|
||||
be updated with the new script. This is a good example where 'near real
|
||||
time' is acceptable. <programlisting language="xml"><groovy:script location="..." refresh-check-delay="0"/></programlisting>
|
||||
In the above example the context will be updated with the new script every
|
||||
time the script is modified. Basically this is the example of the
|
||||
'real-time' and might not be the most efficient way. <programlisting
|
||||
language="xml"><groovy:script location="..." refresh-check-delay="-1"/></programlisting>
|
||||
Any negative number value means the script will never be refreshed after
|
||||
initial initialization of application context. DEFAULT BEHAVIOR
|
||||
<important>Inline defined script can not be reloaded.</important></para>
|
||||
</section>
|
||||
|
||||
<section id="groovy-control-bus">
|
||||
<title>Control Bus</title>
|
||||
|
||||
<para>As described in (<ulink
|
||||
url="http://www.eaipatterns.com/ControlBus.html">EIP</ulink>), the idea
|
||||
behind the Control Bus is that the same messaging system can be used for
|
||||
monitoring and managing the components within the framework as is used for
|
||||
"application-level" messaging. In Spring Integration we build upon the
|
||||
adapters described above so that it's possible to send Messages as a means
|
||||
of invoking exposed operations.<programlisting language="xml"> <groovy:control-bus input-channel="operationChannel"/></programlisting></para>
|
||||
|
||||
<para>The Control Bus has an input channel that can be accessed for
|
||||
invoking operations on the beans in the application context.</para>
|
||||
|
||||
<para>The groovy control bus executes messages on the input channel as
|
||||
Groovy scripts. It takes a message, compiles the body to a Script,
|
||||
customizes it with a GroovyObjectCustomizer, and then executes it. The
|
||||
default customizer just exposes all the beans in the application context
|
||||
as script context objects.</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
<firstname>Gary</firstname>
|
||||
<surname>Russell</surname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Dave</firstname>
|
||||
<surname>Syer</surname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Josh</firstname>
|
||||
<surname>Long</surname>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="jmx"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<section version="5.0" xml:id="jmx" xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:ns5="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ns4="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:ns3="http://www.w3.org/2000/svg"
|
||||
xmlns:ns="http://docbook.org/ns/docbook">
|
||||
<title>JMX Support</title>
|
||||
|
||||
<para>Spring Integration provides Channel Adapters for receiving and
|
||||
@@ -17,18 +21,17 @@
|
||||
<programlisting language="xml"> <jmx:notification-listening-channel-adapter id="adapter"
|
||||
channel="channel"
|
||||
object-name="example.domain:name=publisher"/>
|
||||
</programlisting> <tip>
|
||||
The
|
||||
|
||||
<emphasis>notification-listening-channel-adapter</emphasis>
|
||||
|
||||
registers with an MBeanServer at startup, and the default bean name is "mbeanServer" which happens to be the same bean name generated when using Spring's <context:mbean-server/> element. If you need to use a different name be sure to include the "mbean-server" attribute.
|
||||
</tip> The adapter can also accept a reference to a NotificationFilter
|
||||
and a "handback" Object to provide some context that is passed back with
|
||||
each Notification. Both of those attributes are optional. Extending the
|
||||
above example to include those attributes as well as an explicit
|
||||
MBeanServer bean name would produce the following: <programlisting
|
||||
language="xml"> <jmx:notification-listening-channel-adapter id="adapter"
|
||||
</programlisting> <tip> The
|
||||
<emphasis>notification-listening-channel-adapter</emphasis> registers with
|
||||
an MBeanServer at startup, and the default bean name is "mbeanServer"
|
||||
which happens to be the same bean name generated when using Spring's
|
||||
<context:mbean-server/> element. If you need to use a different name
|
||||
be sure to include the "mbean-server" attribute. </tip> The adapter can
|
||||
also accept a reference to a NotificationFilter and a "handback" Object to
|
||||
provide some context that is passed back with each Notification. Both of
|
||||
those attributes are optional. Extending the above example to include
|
||||
those attributes as well as an explicit MBeanServer bean name would
|
||||
produce the following: <programlisting language="xml"> <jmx:notification-listening-channel-adapter id="adapter"
|
||||
channel="channel"
|
||||
mbean-server="someServer"
|
||||
object-name="example.domain:name=somePublisher"
|
||||
@@ -145,16 +148,17 @@
|
||||
create an instance of the <classname>IntegrationMBeanExporter</classname>,
|
||||
define a bean and provide a reference to an MBeanServer and a domain name
|
||||
(if desired). The domain can be left out in which case the default domain
|
||||
is "spring.application". <programlisting language="xml"> <jmx:mbean-exporter domain="my.company.domain" mbean-server="mbeanServer"/>
|
||||
is "org.springframework.integration". <programlisting language="xml"> <jmx:mbean-exporter domain="my.company.domain" mbean-server="mbeanServer"/>
|
||||
|
||||
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
|
||||
<property name="locateExistingServerIfPossible" value="true"/>
|
||||
</bean></programlisting></para>
|
||||
|
||||
<para>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 using the standard
|
||||
<literal><context:mbean-export/></literal> tag).</para>
|
||||
- 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
|
||||
<literal><context:mbean-export/></literal> tag. </para>
|
||||
</section>
|
||||
|
||||
<section id="jmx-control-bus">
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<title>System Management</title>
|
||||
|
||||
<xi:include href="./message-history.xml"/>
|
||||
<xi:include href="./control-bus.xml"/>
|
||||
<xi:include href="./jmx.xml"/>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<xsd:all minOccurs="0" maxOccurs="1">
|
||||
<xsd:element name="poller" type="integration:innerPollerType" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:all>
|
||||
<xsd:attributeGroup ref="integration:inputOutputChannelGroup" />
|
||||
<xsd:attribute name="customizer" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
@@ -65,7 +66,6 @@
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attributeGroup ref="integration:inputOutputChannelGroup" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user