The <handler-endpoint/> element's "default-output-channel" attribute is now "output-channel". Since the new "return-address-overrides" value is true by default, the "output-channel" takes precedence rather than being a fallback.
This commit is contained in:
@@ -25,13 +25,13 @@ import org.springframework.integration.handler.DefaultMessageHandlerAdapter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Parser for the <em>endpoint</em> element of the integration namespace.
|
||||
* Parser for the <em>handler-endpoint</em> element of the integration namespace.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class EndpointParser extends AbstractTargetEndpointParser {
|
||||
|
||||
private static final String DEFAULT_OUTPUT_CHANNEL_ATTRIBUTE = "default-output-channel";
|
||||
private static final String OUTPUT_CHANNEL_ATTRIBUTE = "output-channel";
|
||||
|
||||
private static final String DEFAULT_OUTPUT_CHANNEL_PROPERTY = "defaultOutputChannelName";
|
||||
|
||||
@@ -58,9 +58,9 @@ public class EndpointParser extends AbstractTargetEndpointParser {
|
||||
|
||||
@Override
|
||||
protected void postProcess(BeanDefinitionBuilder builder, Element element) {
|
||||
String defaultOutputChannel = element.getAttribute(DEFAULT_OUTPUT_CHANNEL_ATTRIBUTE);
|
||||
if (StringUtils.hasText(defaultOutputChannel)) {
|
||||
builder.addPropertyValue(DEFAULT_OUTPUT_CHANNEL_PROPERTY, defaultOutputChannel);
|
||||
String outputChannel = element.getAttribute(OUTPUT_CHANNEL_ATTRIBUTE);
|
||||
if (StringUtils.hasText(outputChannel)) {
|
||||
builder.addPropertyValue(DEFAULT_OUTPUT_CHANNEL_PROPERTY, outputChannel);
|
||||
}
|
||||
String returnAddressOverridesAttribute = element.getAttribute(RETURN_ADDRESS_OVERRIDES_ATTRIBUTE);
|
||||
boolean returnAddressOverrides = "true".equals(returnAddressOverridesAttribute);
|
||||
|
||||
@@ -148,9 +148,9 @@
|
||||
</xsd:annotation>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="targetEndpointType">
|
||||
<xsd:attribute name="default-output-channel" type="xsd:string"/>
|
||||
<xsd:attribute name="handler" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="method" type="xsd:string"/>
|
||||
<xsd:attribute name="output-channel" type="xsd:string"/>
|
||||
<xsd:attribute name="reply-handler" type="xsd:string"/>
|
||||
<xsd:attribute name="return-address-overrides" type="xsd:boolean" default="false"/>
|
||||
</xsd:extension>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<handler ref="handler3"/>
|
||||
</handler-chain>
|
||||
|
||||
<handler-endpoint input-channel="testChannel" handler="chain" default-output-channel="replyChannel">
|
||||
<handler-endpoint input-channel="testChannel" handler="chain" output-channel="replyChannel">
|
||||
<schedule period="100"/>
|
||||
</handler-endpoint>
|
||||
|
||||
|
||||
@@ -19,15 +19,15 @@
|
||||
<si:channel id="errorChannel"/>
|
||||
|
||||
<si:handler-endpoint input-channel="channel1WithOverride" handler="testBean" method="duplicate"
|
||||
default-output-channel="channel2" return-address-overrides="true"/>
|
||||
output-channel="channel2" return-address-overrides="true"/>
|
||||
|
||||
<si:handler-endpoint input-channel="channel3WithOverride" handler="testBean" method="duplicate"
|
||||
return-address-overrides="true"/>
|
||||
|
||||
<si:handler-endpoint input-channel="channel1" handler="testBean" method="duplicate" default-output-channel="channel2"/>
|
||||
<si:handler-endpoint input-channel="channel2" handler="testBean" method="duplicate" default-output-channel="channel3"/>
|
||||
<si:handler-endpoint input-channel="channel1" handler="testBean" method="duplicate" output-channel="channel2"/>
|
||||
<si:handler-endpoint input-channel="channel2" handler="testBean" method="duplicate" output-channel="channel3"/>
|
||||
<si:handler-endpoint input-channel="channel3" handler="testBean" method="duplicate"/>
|
||||
<si:handler-endpoint input-channel="channel4" handler="testBean" method="duplicate" default-output-channel="replyChannel"/>
|
||||
<si:handler-endpoint input-channel="channel4" handler="testBean" method="duplicate" output-channel="replyChannel"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.integration.endpoint.TestBean"/>
|
||||
|
||||
|
||||
@@ -126,13 +126,13 @@
|
||||
<para>
|
||||
To create a Message Endpoint instance, use the 'handler-endpoint' element with the 'input-channel' and 'handler'
|
||||
attributes:
|
||||
<programlisting><endpoint input-channel="exampleChannel" handler="exampleHandler"/></programlisting>
|
||||
<programlisting><handler-endpoint input-channel="exampleChannel" handler="exampleHandler"/></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
The configuration above assumes that "exampleHandler" is an actual implementation of the
|
||||
<interfacename>MessageHandler</interfacename> interface as described in <xref linkend="api-messagehandler"/>.
|
||||
To delegate to an arbitrary method of any object, simply add the "method" attribute.
|
||||
<programlisting><endpoint input-channel="exampleChannel" handler="somePojo" method="someMethod"/></programlisting>
|
||||
<programlisting><handler-endpoint input-channel="exampleChannel" handler="somePojo" method="someMethod"/></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
In either case (<interfacename>MessageHandler</interfacename> or arbitrary object/method), when the handling
|
||||
@@ -144,11 +144,11 @@
|
||||
lookup in the <interfacename>ChannelRegistry</interfacename>. If the message header does not contain a
|
||||
'returnAddress' property at all, then it will fallback to its own 'defaultOutputChannelName' property. If
|
||||
neither is available, then a <classname>MessageHandlingException</classname> will be thrown. To configure the
|
||||
default output channel when using the XML namespace, provide the 'default-output-channel' attribute:
|
||||
<programlisting><endpoint input-channel="exampleChannel"
|
||||
output channel when using the XML namespace, provide the 'output-channel' attribute:
|
||||
<programlisting><handler-endpoint input-channel="exampleChannel"
|
||||
handler="somePojo"
|
||||
method="someMethod"
|
||||
default-output-channel="replyChannel"/></programlisting>
|
||||
output-channel="replyChannel"/></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Endpoints also support <interfacename>MessageSelectors</interfacename> as described in
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
<channel id="channel2"/>
|
||||
|
||||
<source-endpoint source="fileSource" channel="channel1">
|
||||
<schedule period="30000"/>
|
||||
<schedule period="10000"/>
|
||||
</source-endpoint>
|
||||
|
||||
<handler-endpoint input-channel="channel1" default-output-channel="channel2"
|
||||
<handler-endpoint input-channel="channel1" output-channel="channel2"
|
||||
handler="exclaimer" method="exclaim"/>
|
||||
|
||||
<file-source id="fileSource" directory="${java.io.tmpdir}/spring-integration-samples/input"/>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<message-bus auto-create-channels="true"/>
|
||||
|
||||
<handler-endpoint input-channel="inputChannel"
|
||||
default-output-channel="outputChannel"
|
||||
output-channel="outputChannel"
|
||||
handler="helloService"
|
||||
method="sayHello"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user