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:
Mark Fisher
2008-04-27 05:29:59 +00:00
parent 9eaa088052
commit 09333d62cb
7 changed files with 19 additions and 19 deletions

View File

@@ -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);

View File

@@ -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>

View File

@@ -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>

View File

@@ -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"/>

View File

@@ -126,13 +126,13 @@
<para>
To create a Message Endpoint instance, use the 'handler-endpoint' element with the 'input-channel' and 'handler'
attributes:
<programlisting>&lt;endpoint input-channel="exampleChannel" handler="exampleHandler"/&gt;</programlisting>
<programlisting>&lt;handler-endpoint input-channel="exampleChannel" handler="exampleHandler"/&gt;</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>&lt;endpoint input-channel="exampleChannel" handler="somePojo" method="someMethod"/&gt;</programlisting>
<programlisting>&lt;handler-endpoint input-channel="exampleChannel" handler="somePojo" method="someMethod"/&gt;</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>&lt;endpoint input-channel="exampleChannel"
output channel when using the XML namespace, provide the 'output-channel' attribute:
<programlisting>&lt;handler-endpoint input-channel="exampleChannel"
handler="somePojo"
method="someMethod"
default-output-channel="replyChannel"/&gt;</programlisting>
output-channel="replyChannel"/&gt;</programlisting>
</para>
<para>
Endpoints also support <interfacename>MessageSelectors</interfacename> as described in

View File

@@ -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"/>

View File

@@ -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"/>