INT-1426, removed references to @MessageMapping annotation
This commit is contained in:
@@ -250,46 +250,6 @@ public class FooService {
|
||||
}
|
||||
|
||||
}</programlisting>
|
||||
<para>
|
||||
A more powerful and flexible way to map Messages to method arguments is to use <interfacename>@MessageMapping</interfacename>
|
||||
annotation which allows you to define expression via Spring 3.0 Expression Language support to help parse
|
||||
the message payload and/or header and map the parsed values to method arguments.
|
||||
</para>
|
||||
<para>For example:</para>
|
||||
<para>
|
||||
<programlisting language="java">public void fromMessageToMethod(@MessageMapping("headers.day") String argA,
|
||||
@MessageMapping("#this") Message message,
|
||||
@MessageMapping("payload") Employee payloadArg,
|
||||
@MessageMapping("payload.fname") String value,
|
||||
@MessageMapping("headers") Map headers) { ... } </programlisting>
|
||||
|
||||
As you can see, the above method takes 5 arguments where:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>First - will be mapped to the value of 'day' header</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Second - will be mapped to the Message itself</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Third - will be mapped to the Payload</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Fourth - will be mapped to the 'fname' property of a Payload object</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Fifth - will be mapped to MessageHeaders</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<tip>
|
||||
A Map-typed argument does not strictly require the use of the @Headers annotation. In other words
|
||||
the following is also valid: <programlisting language="java">public void bar(String payload, Map<String, Object> headerMap)</programlisting>
|
||||
However this can lead to unresolvable ambiguities if the payload is itself a Map. For that reason, we
|
||||
highly recommend using the annotation whenever expecting the headers. For a much more detailed
|
||||
description, see the javadoc for <classname>MethodParameterMessageMapper</classname>.
|
||||
</tip>
|
||||
</para>
|
||||
<para>
|
||||
For several of these annotations, when a Message-handling method returns a non-null value, the endpoint will
|
||||
attempt to send a reply. This is consistent across both configuration options (namespace and annotations) in
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
The argument in the service method could be either a Message or an arbitrary type. If the latter, then it will
|
||||
be assumed that it is a Message payload, which will be extracted from the message and injected into such service
|
||||
method. This is generally the recommended approach as it follows and promotes a POJO model when working with Spring
|
||||
Integration. Arguments may also have @Header, @Headers or @MessageMapping annotations as described in <xref linkend="annotations"/>
|
||||
Integration. Arguments may also have @Header, @Headers annotations as described in <xref linkend="annotations"/>
|
||||
</para>
|
||||
<note>
|
||||
Since v1.0.3 of Spring Integration, the service method is not required to have an argument at all, which means you
|
||||
|
||||
Reference in New Issue
Block a user