Fixed #INT-1984 - Error documentation about Converter; #INT-1967 Standardize namespace pre-fixes in documentation
This commit is contained in:
@@ -370,12 +370,12 @@ public Message<?> receive(final PollableChannel<?> channel) { ... }]]></programl
|
|||||||
<title>Configuring Message Channels</title>
|
<title>Configuring Message Channels</title>
|
||||||
<para>
|
<para>
|
||||||
To create a Message Channel instance, you can use the <channel/> element:
|
To create a Message Channel instance, you can use the <channel/> element:
|
||||||
<programlisting language="xml"><channel id="exampleChannel"/></programlisting>
|
<programlisting language="xml"><int:channel id="exampleChannel"/></programlisting>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
The default channel type is <emphasis>Point to Point</emphasis>. To create a
|
The default channel type is <emphasis>Point to Point</emphasis>. To create a
|
||||||
<emphasis>Publish Subscribe</emphasis> channel, use the <publish-subscribe-channel/> element:
|
<emphasis>Publish Subscribe</emphasis> channel, use the <publish-subscribe-channel/> element:
|
||||||
<programlisting language="xml"><publish-subscribe-channel id="exampleChannel"/></programlisting>
|
<programlisting language="xml"><int:publish-subscribe-channel id="exampleChannel"/></programlisting>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
When using the <channel/> element without any sub-elements, it will create a <classname>DirectChannel</classname>
|
When using the <channel/> element without any sub-elements, it will create a <classname>DirectChannel</classname>
|
||||||
@@ -390,20 +390,20 @@ public Message<?> receive(final PollableChannel<?> channel) { ... }]]></programl
|
|||||||
<title>DirectChannel Configuration</title>
|
<title>DirectChannel Configuration</title>
|
||||||
<para>
|
<para>
|
||||||
As mentioned above, <classname>DirectChannel</classname> is the default type.
|
As mentioned above, <classname>DirectChannel</classname> is the default type.
|
||||||
<programlisting language="xml"><![CDATA[<channel id="directChannel"/>]]></programlisting>
|
<programlisting language="xml"><![CDATA[<int:channel id="directChannel"/>]]></programlisting>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
A default channel will have a <emphasis>round-robin</emphasis> load-balancer and will also have
|
A default channel will have a <emphasis>round-robin</emphasis> load-balancer and will also have
|
||||||
failover enabled (See the discussion in <xref linkend="channel-implementations-directchannel"/>
|
failover enabled (See the discussion in <xref linkend="channel-implementations-directchannel"/>
|
||||||
for more detail). To disable one or both of these, add a <dispatcher/> sub-element and
|
for more detail). To disable one or both of these, add a <dispatcher/> sub-element and
|
||||||
configure the attributes:
|
configure the attributes:
|
||||||
<programlisting language="xml"><![CDATA[<channel id="failFastChannel">
|
<programlisting language="xml"><![CDATA[<int:channel id="failFastChannel">
|
||||||
<dispatcher failover="false"/>
|
<dispatcher failover="false"/>
|
||||||
</channel>
|
</channel>
|
||||||
|
|
||||||
<channel id="channelWithFixedOrderSequenceFailover">
|
<int:channel id="channelWithFixedOrderSequenceFailover">
|
||||||
<dispatcher load-balancer="none"/>
|
<int:dispatcher load-balancer="none"/>
|
||||||
</channel>
|
</int:channel>
|
||||||
]]></programlisting>
|
]]></programlisting>
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
@@ -429,7 +429,7 @@ public Message<?> receive(final PollableChannel<?> channel) { ... }]]></programl
|
|||||||
datatype. In other words, the "numberChannel" above would accept messages whose payload is
|
datatype. In other words, the "numberChannel" above would accept messages whose payload is
|
||||||
<classname>java.lang.Integer</classname> or <classname>java.lang.Double</classname>. Multiple types can be
|
<classname>java.lang.Integer</classname> or <classname>java.lang.Double</classname>. Multiple types can be
|
||||||
provided as a comma-delimited list:
|
provided as a comma-delimited list:
|
||||||
<programlisting language="xml"><![CDATA[<channel id="stringOrNumberChannel" datatype="java.lang.String,java.lang.Number"/>]]></programlisting>
|
<programlisting language="xml"><![CDATA[<int:channel id="stringOrNumberChannel" datatype="java.lang.String,java.lang.Number"/>]]></programlisting>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
So the 'numberChannel' above will only accept Messages with a data-type of <classname>java.lang.Number</classname>. But what happens
|
So the 'numberChannel' above will only accept Messages with a data-type of <classname>java.lang.Number</classname>. But what happens
|
||||||
@@ -441,14 +441,14 @@ public Message<?> receive(final PollableChannel<?> channel) { ... }]]></programl
|
|||||||
<para>
|
<para>
|
||||||
You can even register custom converters. For example, let's say you are sending a Message with a String payload to the 'numberChannel' we configured above.
|
You can even register custom converters. For example, let's say you are sending a Message with a String payload to the 'numberChannel' we configured above.
|
||||||
<programlisting language="java"><![CDATA[
|
<programlisting language="java"><![CDATA[
|
||||||
MessageChannel inChannel = context.getBean("inChannel", MessageChannel.class);
|
MessageChannel inChannel = context.getBean("numberChannel", MessageChannel.class);
|
||||||
inChannel.send(new GenericMessage<String>("5"));
|
inChannel.send(new GenericMessage<String>("5"));
|
||||||
]]></programlisting>
|
]]></programlisting>
|
||||||
|
|
||||||
Typically this would be a perfectly legal operation, however since we are using Datatype Channel the result of such operation would generate an exception:
|
Typically this would be a perfectly legal operation, however since we are using Datatype Channel the result of such operation would generate an exception:
|
||||||
|
|
||||||
<programlisting language="java"><![CDATA[
|
<programlisting language="java"><![CDATA[
|
||||||
Exception in thread "main" org.springframework.integration.MessageDeliveryException: Channel 'inChannel'
|
Exception in thread "main" org.springframework.integration.MessageDeliveryException: Channel 'numberChannel'
|
||||||
expected one of the following datataypes [class java.lang.Number], but received [class java.lang.String]
|
expected one of the following datataypes [class java.lang.Number], but received [class java.lang.String]
|
||||||
. . .
|
. . .
|
||||||
]]></programlisting>
|
]]></programlisting>
|
||||||
@@ -474,9 +474,9 @@ payload to an Integer.
|
|||||||
<para>
|
<para>
|
||||||
To create a <classname>QueueChannel</classname>, use the <queue/> sub-element.
|
To create a <classname>QueueChannel</classname>, use the <queue/> sub-element.
|
||||||
You may specify the channel's capacity:
|
You may specify the channel's capacity:
|
||||||
<programlisting language="xml"><channel id="queueChannel">
|
<programlisting language="xml"><int:channel id="queueChannel">
|
||||||
<queue capacity="25"/>
|
<queue capacity="25"/>
|
||||||
</channel></programlisting>
|
</int:channel></programlisting>
|
||||||
<note>
|
<note>
|
||||||
If you do not provide a value for the 'capacity' attribute on this <queue/> sub-element,
|
If you do not provide a value for the 'capacity' attribute on this <queue/> sub-element,
|
||||||
the resulting queue will be unbounded. To avoid issues such as OutOfMemoryErrors, it is highly
|
the resulting queue will be unbounded. To avoid issues such as OutOfMemoryErrors, it is highly
|
||||||
@@ -534,14 +534,14 @@ payload to an Integer.
|
|||||||
To create a <classname>PublishSubscribeChannel</classname>, use the <publish-subscribe-channel/> element.
|
To create a <classname>PublishSubscribeChannel</classname>, use the <publish-subscribe-channel/> element.
|
||||||
When using this element, you can also specify the <code>task-executor</code> used for publishing
|
When using this element, you can also specify the <code>task-executor</code> used for publishing
|
||||||
Messages (if none is specified it simply publishes in the sender's thread):
|
Messages (if none is specified it simply publishes in the sender's thread):
|
||||||
<programlisting language="xml"><publish-subscribe-channel id="pubsubChannel" task-executor="someExecutor"/></programlisting>
|
<programlisting language="xml"><int:publish-subscribe-channel id="pubsubChannel" task-executor="someExecutor"/></programlisting>
|
||||||
If you are providing a <emphasis>Resequencer</emphasis> or <emphasis>Aggregator</emphasis> downstream
|
If you are providing a <emphasis>Resequencer</emphasis> or <emphasis>Aggregator</emphasis> downstream
|
||||||
from a <classname>PublishSubscribeChannel</classname>, then you can set the 'apply-sequence' property
|
from a <classname>PublishSubscribeChannel</classname>, then you can set the 'apply-sequence' property
|
||||||
on the channel to <code>true</code>. That will indicate that the channel should set the sequence-size
|
on the channel to <code>true</code>. That will indicate that the channel should set the sequence-size
|
||||||
and sequence-number Message headers as well as the correlation id prior to passing the Messages along.
|
and sequence-number Message headers as well as the correlation id prior to passing the Messages along.
|
||||||
For example, if there are 5 subscribers, the sequence-size would be set to 5, and the Messages would
|
For example, if there are 5 subscribers, the sequence-size would be set to 5, and the Messages would
|
||||||
have sequence-number header values ranging from 1 to 5.
|
have sequence-number header values ranging from 1 to 5.
|
||||||
<programlisting language="xml"><publish-subscribe-channel id="pubsubChannel" apply-sequence="true"/></programlisting>
|
<programlisting language="xml"><int:publish-subscribe-channel id="pubsubChannel" apply-sequence="true"/></programlisting>
|
||||||
<note>
|
<note>
|
||||||
The <code>apply-sequence</code> value is <code>false</code> by default so that a Publish Subscribe Channel
|
The <code>apply-sequence</code> value is <code>false</code> by default so that a Publish Subscribe Channel
|
||||||
can send the exact same Message instances to multiple outbound channels. Since Spring Integration
|
can send the exact same Message instances to multiple outbound channels. Since Spring Integration
|
||||||
@@ -561,36 +561,36 @@ payload to an Integer.
|
|||||||
between sender and receiver so that any active transaction context will not be shared by the invocation
|
between sender and receiver so that any active transaction context will not be shared by the invocation
|
||||||
of the handler (i.e. the handler may throw an Exception, but the send invocation has already returned
|
of the handler (i.e. the handler may throw an Exception, but the send invocation has already returned
|
||||||
successfully).
|
successfully).
|
||||||
<programlisting language="xml"><![CDATA[<channel id="executorChannel">
|
<programlisting language="xml"><![CDATA[<int:channel id="executorChannel">
|
||||||
<dispatcher task-executor="someExecutor"/>
|
<int:dispatcher task-executor="someExecutor"/>
|
||||||
</channel>]]></programlisting>
|
</int:channel>]]></programlisting>
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
The <code>load-balancer</code> and <code>failover</code> options are also both available on the <dispatcher/> sub-element
|
The <code>load-balancer</code> and <code>failover</code> options are also both available on the <dispatcher/> sub-element
|
||||||
as described above in <xref linkend="channel-configuration-directchannel"/>. The same defaults
|
as described above in <xref linkend="channel-configuration-directchannel"/>. The same defaults
|
||||||
apply as well. So, the channel will have a round-robin load-balancing strategy with failover
|
apply as well. So, the channel will have a round-robin load-balancing strategy with failover
|
||||||
enabled unless explicit configuration is provided for one or both of those attributes.
|
enabled unless explicit configuration is provided for one or both of those attributes.
|
||||||
<programlisting language="xml"><![CDATA[<channel id="executorChannelWithoutFailover">
|
<programlisting language="xml"><![CDATA[<int:channel id="executorChannelWithoutFailover">
|
||||||
<dispatcher task-executor="someExecutor" failover="false"/>
|
<int:dispatcher task-executor="someExecutor" failover="false"/>
|
||||||
</channel>]]></programlisting>
|
</int:channel>]]></programlisting>
|
||||||
</note>
|
</note>
|
||||||
</section>
|
</section>
|
||||||
<section id="channel-configuration-prioritychannel">
|
<section id="channel-configuration-prioritychannel">
|
||||||
<title>PriorityChannel Configuration</title>
|
<title>PriorityChannel Configuration</title>
|
||||||
<para>
|
<para>
|
||||||
To create a <classname>PriorityChannel</classname>, use the <priority-queue/> sub-element:
|
To create a <classname>PriorityChannel</classname>, use the <priority-queue/> sub-element:
|
||||||
<programlisting language="xml"><![CDATA[<channel id="priorityChannel">
|
<programlisting language="xml"><![CDATA[<int:channel id="priorityChannel">
|
||||||
<priority-queue capacity="20"/>
|
<int:priority-queue capacity="20"/>
|
||||||
</channel>]]></programlisting>
|
</int:channel>]]></programlisting>
|
||||||
By default, the channel will consult the <classname>MessagePriority</classname> header of the
|
By default, the channel will consult the <classname>MessagePriority</classname> header of the
|
||||||
message. However, a custom <interfacename>Comparator</interfacename> reference may be
|
message. However, a custom <interfacename>Comparator</interfacename> reference may be
|
||||||
provided instead. Also, note that the <classname>PriorityChannel</classname> (like the other types)
|
provided instead. Also, note that the <classname>PriorityChannel</classname> (like the other types)
|
||||||
does support the <code>datatype</code> attribute. As with the QueueChannel, it also supports a <code>capacity</code> attribute.
|
does support the <code>datatype</code> attribute. As with the QueueChannel, it also supports a <code>capacity</code> attribute.
|
||||||
The following example demonstrates all of these:
|
The following example demonstrates all of these:
|
||||||
<programlisting language="xml"><![CDATA[<channel id="priorityChannel" datatype="example.Widget">
|
<programlisting language="xml"><![CDATA[<int:channel id="priorityChannel" datatype="example.Widget">
|
||||||
<priority-queue comparator="widgetComparator"
|
<int:priority-queue comparator="widgetComparator"
|
||||||
capacity="10"/>
|
capacity="10"/>
|
||||||
</channel>
|
</int:channel>
|
||||||
]]></programlisting>
|
]]></programlisting>
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
@@ -601,9 +601,9 @@ payload to an Integer.
|
|||||||
a <rendezvous-queue>. It does not provide any additional configuration options to
|
a <rendezvous-queue>. It does not provide any additional configuration options to
|
||||||
those described above, and its queue does not accept any capacity value since it is a
|
those described above, and its queue does not accept any capacity value since it is a
|
||||||
0-capacity direct handoff queue.
|
0-capacity direct handoff queue.
|
||||||
<programlisting language="xml"><![CDATA[<channel id="rendezvousChannel"/>
|
<programlisting language="xml"><![CDATA[<int:channel id="rendezvousChannel"/>
|
||||||
<rendezvous-queue/>
|
<int:rendezvous-queue/>
|
||||||
</channel>
|
</int:channel>
|
||||||
]]></programlisting>
|
]]></programlisting>
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
@@ -611,7 +611,7 @@ payload to an Integer.
|
|||||||
<title>Scoped Channel Configuration</title>
|
<title>Scoped Channel Configuration</title>
|
||||||
<para>
|
<para>
|
||||||
Any channel can be configured with a "scope" attribute.
|
Any channel can be configured with a "scope" attribute.
|
||||||
<programlisting language="xml"><![CDATA[<channel id="threadLocalChannel" scope="thread"/>]]></programlisting>
|
<programlisting language="xml"><![CDATA[<int:channel id="threadLocalChannel" scope="thread"/>]]></programlisting>
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -622,11 +622,11 @@ payload to an Integer.
|
|||||||
<interceptors/> sub-element can be added within <channel/> (or the more specific element
|
<interceptors/> sub-element can be added within <channel/> (or the more specific element
|
||||||
types). Provide the <code>ref</code> attribute to reference any Spring-managed object that implements the
|
types). Provide the <code>ref</code> attribute to reference any Spring-managed object that implements the
|
||||||
<interfacename>ChannelInterceptor</interfacename> interface:
|
<interfacename>ChannelInterceptor</interfacename> interface:
|
||||||
<programlisting language="xml"><![CDATA[<channel id="exampleChannel">
|
<programlisting language="xml"><![CDATA[<int:channel id="exampleChannel">
|
||||||
]]><emphasis><![CDATA[<interceptors>
|
]]><emphasis><![CDATA[<int:interceptors>
|
||||||
<ref bean="trafficMonitoringInterceptor"/>
|
<ref bean="trafficMonitoringInterceptor"/>
|
||||||
</interceptors>]]></emphasis><![CDATA[
|
</int:interceptors>]]></emphasis><![CDATA[
|
||||||
</channel>]]></programlisting>
|
</int:channel>]]></programlisting>
|
||||||
In general, it is a good idea to define the interceptor implementations in a separate location since they
|
In general, it is a good idea to define the interceptor implementations in a separate location since they
|
||||||
usually provide common behavior that can be reused across multiple channels.
|
usually provide common behavior that can be reused across multiple channels.
|
||||||
</para>
|
</para>
|
||||||
@@ -688,13 +688,13 @@ payload to an Integer.
|
|||||||
As mentioned above, Spring Integration provides a simple <emphasis>Wire Tap</emphasis> interceptor out of
|
As mentioned above, Spring Integration provides a simple <emphasis>Wire Tap</emphasis> interceptor out of
|
||||||
the box. You can configure a <emphasis>Wire Tap</emphasis> on any channel within an <interceptors/> element.
|
the box. You can configure a <emphasis>Wire Tap</emphasis> on any channel within an <interceptors/> element.
|
||||||
This is especially useful for debugging, and can be used in conjunction with Spring Integration's logging
|
This is especially useful for debugging, and can be used in conjunction with Spring Integration's logging
|
||||||
Channel Adapter as follows: <programlisting language="xml"><![CDATA[ <channel id="in">
|
Channel Adapter as follows: <programlisting language="xml"><![CDATA[ <int:channel id="in">
|
||||||
<interceptors>
|
<int:interceptors>
|
||||||
<wire-tap channel="logger"/>
|
<int:wire-tap channel="logger"/>
|
||||||
</interceptors>
|
</int:interceptors>
|
||||||
</channel>
|
</int:channel>
|
||||||
|
|
||||||
<logging-channel-adapter id="logger" level="DEBUG"/>]]></programlisting>
|
<int:logging-channel-adapter id="logger" level="DEBUG"/>]]></programlisting>
|
||||||
<tip>
|
<tip>
|
||||||
The 'logging-channel-adapter' also accepts an 'expression' attribute so that you can evaluate
|
The 'logging-channel-adapter' also accepts an 'expression' attribute so that you can evaluate
|
||||||
a SpEL expression against 'payload' and/or 'headers' variables. Alternatively, to simply log
|
a SpEL expression against 'payload' and/or 'headers' variables. Alternatively, to simply log
|
||||||
|
|||||||
Reference in New Issue
Block a user