Merge remote-tracking branch 'upstream/master' into 4.0.0-WIP

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/channel/registry/ChannelRegistry.java
	spring-integration-core/src/main/java/org/springframework/integration/channel/registry/LocalChannelRegistry.java
	spring-integration-core/src/main/java/org/springframework/integration/mapping/AbstractHeaderMapper.java
	spring-integration-core/src/main/java/org/springframework/integration/support/json/AbstractJacksonJsonMessageParser.java
	spring-integration-core/src/test/java/org/springframework/integration/channel/registry/LocalChannelRegistryTests.java
	spring-integration-core/src/test/java/org/springframework/integration/handler/ServiceActivatorDefaultFrameworkMethodTests.java
	spring-integration-jmx/src/test/java/org/springframework/integration/jmx/ServiceActivatorDefaultFrameworkMethodTests.java
	spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/OperationInvokingOutboundGatewayTests.java

Resolved.
This commit is contained in:
Gary Russell
2013-11-01 18:19:02 -04:00
65 changed files with 2126 additions and 909 deletions

View File

@@ -108,8 +108,9 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp
</para>
<para>
<classname>DefaultFtpSessionFactory</classname> provides an abstraction over the underlying client API which, in the current release of
Spring Integration, is <ulink url="http://commons.apache.org/net/">Apache Commons Net</ulink>. This spares you from the low level configuration details
<classname>DefaultFtpSessionFactory</classname> provides an abstraction over the underlying client API which,
since <emphasis>Spring Integration 2.0</emphasis>, is <ulink url="http://commons.apache.org/net/">Apache Commons Net</ulink>.
This spares you from the low level configuration details
of the <classname>org.apache.commons.net.ftp.FTPClient</classname>. However there are times when access to lower level <classname>FTPClient</classname> details is
necessary to achieve more advanced configuration (e.g., setting data timeout, default timeout etc.). For that purpose, <classname>AbstractFtpSessionFactory</classname>
(the base class for all FTP Session Factories) exposes hooks, in the form of the two post-processing methods below.

View File

@@ -66,7 +66,7 @@
custom <interfacename>HttpMessageConverter</interfacename> to add the default converters after the custom converters.
By default this flag is set to false, meaning that the custom converters replace the default list.
</para>
<para>Starting with this release MultiPart File support was implemented. If the request has been wrapped as a
<para>Starting with <emphasis>Spring Integration 2.0</emphasis>, MultiPart File support is implemented. If the request has been wrapped as a
<emphasis>MultipartHttpServletRequest</emphasis>, when using the default converters, that request will be converted
to a Message payload that is a MultiValueMap containing values that may be byte arrays, Strings, or instances of
Spring's <interfacename>MultipartFile</interfacename> depending on the content type of the individual parts.
@@ -619,7 +619,7 @@ By default the HTTP request will be generated using an instance of <classname>Si
</para>
<para>
<classname><ulink url="http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.html">HttpComponentsClientHttpRequestFactory</ulink></classname>
- Uses <ulink url="http://hc.apache.org/httpcomponents-client-ga/httpclient/">Apache HttpComponents HttpClient</ulink> (Since Spring 3.1)
- Uses <ulink url="http://hc.apache.org/httpcomponents-client-ga/">Apache HttpComponents HttpClient</ulink> (Since Spring 3.1)
</para>
<para>
<classname><ulink url="http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/http/client/CommonsClientHttpRequestFactory.html">ClientHttpRequestFactory</ulink></classname>
@@ -652,6 +652,13 @@ By default the HTTP request will be generated using an instance of <classname>Si
</para>
</note>
<important>
When using the <emphasis>Apache HttpComponents HttpClient</emphasis> with a Pooling Connection Manager, be aware that, by
default, the connection manager will create no more than 2 concurrent connections per given route and no more than 20 connections
in total. For many real-world applications these limits may prove too constraining. Refer to the Apache documentation
(link above) for information about configuring this important component.
</important>
<para>
Here is an example of how to configure an <emphasis>HTTP Outbound Gateway</emphasis>
using a <classname>SimpleClientHttpRequestFactory</classname>, configured

View File

@@ -81,7 +81,7 @@
relatively simple. It only requires a JMX ObjectName in its
configuration as shown below.
</para>
<programlisting language="xml"><![CDATA[<context:mbean:export/>
<programlisting language="xml"><![CDATA[<context:mbean-export/>
<int-jmx:notification-publishing-channel-adapter id="adapter"
channel="channel"
@@ -106,7 +106,7 @@
key. On the other hand, you can rely on a fallback <emphasis>default-notification-type</emphasis>
attribute provided in the configuration.
</para>
<programlisting language="xml"><![CDATA[<context:mbean:export/>
<programlisting language="xml"><![CDATA[<context:mbean-export/>
<int-jmx:notification-publishing-channel-adapter id="adapter"
channel="channel"
@@ -242,7 +242,8 @@
and a domain name (if desired). The domain can be left out, in which
case the default domain is <emphasis>org.springframework.integration</emphasis>.
</para>
<programlisting language="xml"><![CDATA[<int-jmx:mbean-export default-domain="my.company.domain" server="mbeanServer"/>
<programlisting language="xml"><![CDATA[<int-jmx:mbean-export id="integrationMBeanExporter"
default-domain="my.company.domain" server="mbeanServer"/>
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<property name="locateExistingServerIfPossible" value="true"/>
@@ -250,7 +251,7 @@
<para>
Once the exporter is defined, start up your application with:
</para>
<screen>-Dcom.sun.management.jmxremote
<screen> -Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=6969
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false</screen>
@@ -262,16 +263,20 @@
sophisticated features than JConsole.)
</para>
<para>
<important>
<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, and certain other components in Spring
Integration, using the standard <literal>&lt;context:mbean-export/&gt;</literal>
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).
</para>
queued messages.
</para>
<para>
It also has a useful operation, as discussed in <xref linkend="jmx-mbean-shutdown"/>.
</para>
</important>
<section id="jmx-mbean-features">
<title>MBean ObjectNames</title>
@@ -361,6 +366,46 @@
</tbody>
</tgroup>
</table>
<para>
Custom elements can be appended to the object name by providing a reference to a
<classname>Properties</classname> object in the <code>object-name-static-properties</code> attribute.
</para>
<para>
Also, since <emphasis>Spring Integration 3.0</emphasis>, you can use a custom
<ulink url="http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/jmx/export/naming/ObjectNamingStrategy.html"
>ObjectNamingStrategy</ulink>
using the <code>object-naming-strategy</code> attribute. This permits greater control over the naming of the
MBeans. For example, to group all Integration MBeans under
an 'Integration' type. A simple custom naming strategy implementation might be:
</para>
<programlisting language="java"><![CDATA[public class Namer implements ObjectNamingStrategy {
private final ObjectNamingStrategy realNamer = new KeyNamingStrategy();
@Override
public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException {
String actualBeanKey = beanKey.replace("type=", "type=Integration,componentType=");
return realNamer.getObjectName(managedBean, actualBeanKey);
}
}]]></programlisting>
<para>
The <code>beanKey</code> argument is a String containing the standard object name beginning with
the <code>default-domain</code> and including any additional static properties.
This example simply moves the standard <code>type</code> part to <code>componentType</code> and
sets the <code>type</code> to 'Integration',
enabling selection of all Integration MBeans in one query:
<code>"my.domain:type=Integration,*</code>. This also groups the beans under one tree entry under the
domain in tools like VisualVM.
</para>
<note>
The default naming strategy is a
<ulink url="http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/jmx/export/naming/MetadataNamingStrategy.html"
>MetadataNamingStrategy</ulink>. The exporter propagates the <code>default-domain</code> to that object to allow it
to generate a fallback object name if parsing of the bean key fails. If your custom naming strategy is a
<classname>MetadataNamingStrategy</classname> (or subclass), the exporter will <emphasis role="bold">not</emphasis>
propagate the <code>default-domain</code>; you will need to configure it on your strategy bean.
</note>
</section>
<section id="jmx-channel-features">

View File

@@ -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.
</note>
<para>
As discussed in <xref linkend="jmx-mbean-shutdown"/> 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 <classname>IntegrationMBeanExporter</classname>. If no <code>id</code> attribute is provided on
the <code>&lt;int-jmx:mbean-export/></code> definition, the bean will have a generated name. This
name contains a random component to avoid <classname>ObjectName</classname> collisions if multiple
Spring Integration contexts exist in the same JVM (MBeanServer).
</para>
<para>
For this reason, if you wish to invoke the method programmatically, it is recommended that you
provide the exporter with an <code>id</code> attribute so it can easily be accessed in the
application context.
</para>
<para>
Finally, the operation can be invoked using the <code>&lt;control-bus&gt;</code>; see the
<ulink url="https://github.com/spring-projects/spring-integration-samples/tree/master/intermediate/monitoring"
>monitoring Spring Integration sample application</ulink> for details.
</para>
</section>

View File

@@ -205,7 +205,7 @@ public interface TransactionSynchronizationProcessor {
}]]></programlisting>
The factory is responsible for creating a
<ulink url="http://static.springsource.org/spring-framework/docs/3.1.2.RELEASE/javadoc-api/org/springframework/transaction/support/TransactionSynchronization.html">TransactionSynchronization</ulink>
<ulink url="http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/support/TransactionSynchronization.html">TransactionSynchronization</ulink>
object. You can implement your own, or use the one provided by the framework:
<classname>DefaultTransactionSynchronizationFactory</classname>. This implementation returns a
<classname>TransactionSynchronization</classname> that delegates to a default implementation of

View File

@@ -206,7 +206,7 @@ public class Kid {
a BeanCreationException will be thrown. 
</note>
<para>
<emphasis>JSON Transformers</emphasis>
<emphasis role="bold">JSON Transformers</emphasis>
</para>
<para>
<emphasis>Object to JSON</emphasis> and <emphasis>JSON to Object</emphasis> transformers are provided.
@@ -279,7 +279,7 @@ public class Foo {
</para>
<important>
<para>
Beginning with version 2.2, the <code>object-to-json-transformer</code> sets the <emphasis>content-type</emphasis>
Beginning with <emphasis>version 2.2</emphasis>, the <code>object-to-json-transformer</code> sets the <emphasis>content-type</emphasis>
header to <code>application/json</code>, by default, if the input message does not already have that header
present.
</para>
@@ -290,66 +290,50 @@ public class Foo {
attribute to an empty string (<code>""</code>). This will result in a message with no <code>content-type</code>
header, unless such a header was present on the input message.
</para>
<para>
The behavior of adding the default header has a side affect - causing applications with the following
sequence to fail:
</para>
<para>
<code>->object-to-json-transformer->amqp-outbound-adapter----></code>
</para>
<para>
<code>---->amqp-inbound-adapter->json-to-object-transformer-></code>
</para>
<para>
This is because the default <classname>SimpleMessageConverter</classname> used by the inbound adapter doesn't
recognize this content type and the adapter emits a message with a <code>byte[]</code> payload instead of
<code>String</code>, which was the case with earlier versions.
</para>
<para>
If you are using this pattern, there are a number of ways to configure the environment so that JSON
conversion will be performed correctly.
</para>
<para>
One solution is to set the content type to a text type, so the inbound converter will convert the JSON to
String. This solution requires a change to just the outbound application.
</para>
<para>
<programlisting language="xml"><![CDATA[<object-to-json-transformer ... content-type="text/x-json"/>]]></programlisting>
</para>
<para>
The second solution is to eliminate the json transformers altogether and use an
<classname>org.springframework.amqp.support.converter.JsonMessageConverter</classname> on both the
outbound and inbound adapters. This configures the adapters to perform the JSON conversion and
the transformers are not necessary. The converter on the outbound adapter adds
type information to the message properties; the inbound converter uses this type information for the conversion.
The converter is provided to the adapters using the <emphasis>message-converter</emphasis> attribute.
This solution requires a change to both the inbound and outbound applications.
</para>
<para>
The third solution is to eliminate the <emphasis>json-to-object-transformer</emphasis> in just
the inbound application and use an
<classname>org.springframework.amqp.support.converter.JsonMessageConverter</classname> on the
inbound adapter. The converter
is provided to the adapter using the <emphasis>message-converter</emphasis> attribute.
However, because there will be no type information in the message properties,
this also requires adding the <emphasis>defaultType</emphasis> to the converter, using the
same type as currently configured on the <emphasis>json-to-object-transformer</emphasis>.
This solution requires a change to just the inbound application. The configuration below shows
how to configure the message converter; it requires <code>spring-amqp</code> 1.1.3 or
above.
</para>
<programlisting language="xml"><![CDATA[<bean id="jsonConverterWithPOType"
class="org.springframework.amqp.support.converter.JsonMessageConverter">
<property name="classMapper">
<bean class="org.springframework.amqp.support.converter.DefaultClassMapper">
<property name="defaultType"
value="foo.PurchaseOrder" />
</bean>
</property>
</bean>
<int-amqp:inbound-channel-adapter ... message-converter="jsonConverterWithPOType" ... />]]></programlisting>
</important>
<para>
Beginning with <emphasis>version 3.0</emphasis>, the <classname>ObjectToJsonTransformer</classname> adds headers,
reflecting the source type, to the message. Similarly, the <classname>JsonToObjectTransformer</classname> can
use those type headers when converting the JSON to an object. These headers are mapped in the AMQP adapters so that
they are entirely compatible with the Spring-AMQP
<ulink url="http://docs.spring.io/spring-amqp/api/">JsonMessageConverter</ulink>.
</para>
<para>
This enables the following flows to work without any special configuration...
</para>
<para>
<code>...->amqp-outbound-adapter----></code>
</para>
<para>
<code>---->amqp-inbound-adapter->json-to-object-transformer->...</code>
</para>
<para>
Where the outbound adapter is configured with a <classname>JsonMessageConverter</classname> and the
inbound adapter uses the default <classname>SimpleMessageConverter</classname>.
</para>
<para>
<code>...->object-to-json-transformer->amqp-outbound-adapter----></code>
</para>
<para>
<code>---->amqp-inbound-adapter->...</code>
</para>
<para>
Where the outbound adapter is configured with a <classname>SimpleMessageConverter</classname> and the
inbound adapter uses the default <classname>JsonMessageConverter</classname>.
</para>
<para>
<code>...->object-to-json-transformer->amqp-outbound-adapter----></code>
</para>
<para>
<code>---->amqp-inbound-adapter->json-to-object-transformer-></code>
</para>
<para>
Where both adapters are configured with a <classname>SimpleMessageConverter</classname>.
</para>
<note>
When using the headers to determine the type, you should <emphasis role="bold">not</emphasis> provide
a <code>class</code> attribute, because it takes precedence over the headers.
</note>
<para>
In addition to JSON Transformers, Spring Integration provides a built-in <emphasis>#jsonPath</emphasis>
SpEL function for use in expressions. For more information see <xref linkend="spel"/>.

View File

@@ -124,7 +124,7 @@ twitter.oauth.accessTokenSecret=AbRxUAvyNCtqQtxFK8w5ZMtMj20KFhB6o]]></programlis
<link linkend="http://support.twitter.com/groups/31-twitter-basics/topics/109-tweets-messages/articles/119138-types-of-tweets-and-where-they-appear">twitter messages, or tweets</link>
</para>
<para>
The current release of Spring Integration provides support for receiving tweets as <emphasis>Timeline Updates</emphasis>,
<emphasis>Spring Integration version 2.0 and above</emphasis> provides support for receiving tweets as <emphasis>Timeline Updates</emphasis>,
<emphasis>Direct Messages</emphasis>, <emphasis>Mention Messages</emphasis> as well as Search Results.
</para>
<para>
@@ -241,7 +241,7 @@ received.
Twitter outbound channel adapters allow you to send Twitter Messages, or tweets.
</para>
<para>
The current release of Spring Integration supports sending <emphasis>Status Update Messages</emphasis> and <emphasis>Direct Messages</emphasis>.
<emphasis>Spring Integration version 2.0 and above</emphasis> supports sending <emphasis>Status Update Messages</emphasis> and <emphasis>Direct Messages</emphasis>.
Twitter outbound channel adapters will take the Message payload and send it as a Twitter message. Currently the only supported payload type is
<classname>String</classname>, so consider adding a <emphasis>transformer</emphasis> if the payload of the incoming message is not a String.
</para>

View File

@@ -63,12 +63,23 @@
<section id="3.0-jmx">
<title>JMX Support</title>
<para>
A new <code>&lt;int-jmx:tree-polling-channel-adapter/&gt;</code> is provided; this
adapter queries the JMX MBean tree and sends a message with a payload that is the
graph of objects that matches the query. By default the MBeans are mapped to
primitives and simple Objects like Map, List and arrays - permitting simple
transformation, for example, to JSON
<xref linkend="jmx"/>.
<itemizedlist>
<listitem>
A new <code>&lt;int-jmx:tree-polling-channel-adapter/&gt;</code> is provided; this
adapter queries the JMX MBean tree and sends a message with a payload that is the
graph of objects that matches the query. By default the MBeans are mapped to
primitives and simple Objects like Map, List and arrays - permitting simple
transformation, for example, to JSON.
</listitem>
<listitem>
The <classname>IntegrationMBeanExporter</classname> now allows the configuration of
a custom <classname>ObjectNamingStrategy</classname> using the <code>naming-strategy</code>
attribute.
</listitem>
</itemizedlist>
</para>
<para>
For more information, see <xref linkend="jmx"/>.
</para>
</section>
<section id="3.0-tail">
@@ -314,10 +325,20 @@
<section id="3.0-json-transformers">
<title>Jackson Support (JSON)</title>
<para>
A new abstraction for JSON conversion has been introduced. Implementations for Jackson 1.x
and Jackson 2 are currently provided, with the version being determined by presence on
the classpath. Previously, only Jackson 1.x was supported. For more information,
see 'JSON Transformers' in <xref linkend="transformer"/>.
<itemizedlist>
<listitem>
A new abstraction for JSON conversion has been introduced. Implementations for Jackson 1.x
and Jackson 2 are currently provided, with the version being determined by presence on
the classpath. Previously, only Jackson 1.x was supported.
</listitem>
<listitem>
The <classname>ObjectToJsonTransformer</classname> and <classname>JsonToObjectTransformer</classname>
now emit/consume headers containing type information.
</listitem>
</itemizedlist>
</para>
<para>
For more information, see 'JSON Transformers' in <xref linkend="transformer"/>.
</para>
</section>
<section id="3.0-http-endpointss">