INT-3117: Add r-c & r-t Attrs. to Chain Gateways

* Add `reply-channel` and `reply-timeout` to `<gateway>` within `<chain>`
* Add appropriate asserts to `ChainParserTests`

JIRA: https://jira.springsource.org/browse/INT-3117
This commit is contained in:
Artem Bilan
2013-09-13 17:12:24 +03:00
committed by Gary Russell
parent f28f30c880
commit 4d351ada4c
3 changed files with 34 additions and 3 deletions

View File

@@ -573,8 +573,8 @@
<xsd:annotation>
<xsd:documentation>
<![CDATA[
Identifies channel this gateway will subscribe to to receive reply Message.
The reply Message which will then be converted to the return type of the method signature.
Identifies the channel to which this gateway will subscribe, to receive reply Messages.
The reply Message will then be converted to the return type of the method signature.
]]>
</xsd:documentation>
</xsd:annotation>
@@ -763,6 +763,27 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="reply-channel" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[
Identifies the channel to which this gateway will subscribe, to receive reply Messages.
]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="reply-timeout" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[
Specifies how long this gateway will wait for the reply message
before returning. By default it will wait indefinitely. 'null' is returned
if the gateway times out.
Value is specified in milliseconds.
]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="error-channel" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[

View File

@@ -127,7 +127,8 @@
<header-filter id="headerFilterWithinChain" header-names="foo"/>
<payload-serializing-transformer id="payloadSerializingTransformerWithinChain"/>
<payload-deserializing-transformer id="payloadDeserializingTransformerWithinChain"/>
<gateway id="gatewayWithinChain" request-channel="strings"/>
<gateway id="gatewayWithinChain" request-channel="strings" reply-channel="numbers"
request-timeout="1000" reply-timeout="100"/>
<object-to-string-transformer id="objectToStringTransformerWithinChain"/>
<object-to-map-transformer id="objectToMapTransformerWithinChain"/>
<map-to-object-transformer id="mapToObjectTransformerWithinChain"

View File

@@ -53,6 +53,7 @@ import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessageRejectedException;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.PollableChannel;
import org.springframework.integration.gateway.GatewayProxyFactoryBean;
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
import org.springframework.integration.handler.LoggingHandler;
import org.springframework.integration.handler.MessageHandlerChain;
@@ -373,6 +374,14 @@ public class ChainParserTests {
assertTrue(this.beanFactory.containsBean("subComponentsIdSupport1$child.payloadSerializingTransformerWithinChain.handler"));
assertTrue(this.beanFactory.containsBean("subComponentsIdSupport1$child.payloadDeserializingTransformerWithinChain.handler"));
assertTrue(this.beanFactory.containsBean("subComponentsIdSupport1$child.gatewayWithinChain.handler"));
//INT-3117
GatewayProxyFactoryBean gatewayProxyFactoryBean = this.beanFactory.getBean("&subComponentsIdSupport1$child.gatewayWithinChain.handler",
GatewayProxyFactoryBean.class);
assertSame(this.strings, TestUtils.getPropertyValue(gatewayProxyFactoryBean, "defaultRequestChannel", MessageChannel.class));
assertSame(this.numbers, TestUtils.getPropertyValue(gatewayProxyFactoryBean, "defaultReplyChannel", MessageChannel.class));
assertEquals(new Long(1000), TestUtils.getPropertyValue(gatewayProxyFactoryBean, "defaultRequestTimeout", Long.class));
assertEquals(new Long(100), TestUtils.getPropertyValue(gatewayProxyFactoryBean, "defaultReplyTimeout", Long.class));
assertTrue(this.beanFactory.containsBean("subComponentsIdSupport1$child.objectToStringTransformerWithinChain.handler"));
assertTrue(this.beanFactory.containsBean("subComponentsIdSupport1$child.objectToMapTransformerWithinChain.handler"));
assertTrue(this.beanFactory.containsBean("subComponentsIdSupport1$child.mapToObjectTransformerWithinChain.handler"));