INT-2262 - Add reply-timeout to Outbound Gateways

For reference see: https://jira.springsource.org/browse/INT-2262

Add reply-timeout attribute to:

* Amqp Outbound Gateway
* File Outbound Gateway
* Ftp Outbound Gateway
* Sftp Outbound Gateway
* Ws Outbound Gateway

Update Schema Documentation for reply-timeout attribute:

* spring-integration-jpa-2.2.xsd
* spring-integration-jms-2.2.xsd
* spring-integration-jdbc-2.2.xsd
* spring-integration-ip-2.2.xsd
* spring-integration-http-2.2.xsd

Update the *What's new in Spring Integration 2.2* section in the reference manual

INT-2262 - Code Review

* Update copyright year for affected files
* Update author tags for affected files
This commit is contained in:
Gunnar Hillert
2012-07-11 15:58:50 -04:00
committed by Gary Russell
parent 386be70dda
commit b07abcd30c
26 changed files with 374 additions and 117 deletions

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2002-2011 the original author or authors.
*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
@@ -25,9 +25,11 @@ import org.springframework.util.StringUtils;
/**
* Parser for the AMQP 'outbound-channel-adapter' element.
*
*
* @author Mark Fisher
* @author Oleg Zhurakousky
* @author Gunnar Hillert
*
* @since 2.1
*/
public class AmqpOutboundGatewayParser extends AbstractConsumerEndpointParser {
@@ -50,11 +52,12 @@ public class AmqpOutboundGatewayParser extends AbstractConsumerEndpointParser {
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "exchange-name-expression");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "routing-key");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "routing-key-expression");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout", "sendTimeout");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel", "outputChannel");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "return-channel");
IntegrationNamespaceUtils.configureHeaderMapper(element, builder, parserContext, DefaultAmqpHeaderMapper.class, null);
return builder;
}

View File

@@ -161,6 +161,29 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="reply-timeout" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
Allows you to specify how long this gateway will wait for
the reply message to be sent successfully to the reply channel
before throwing an exception. This attribute only applies when the
channel might block, for example when using a bounded queue channel that
is currently full.
Also, keep in mind that when sending to a DirectChannel, the
invocation will occur in the sender's thread. Therefore,
the failing of the send operation may be caused by other
components further downstream.
The "reply-timeout" attribute maps to the "sendTimeout" property of the
underlying 'MessagingTemplate' instance (org.springframework.integration.core.MessagingTemplate).
The attribute will default, if not specified, to '-1', meaning that
by default, the Gateway will wait indefinitely. The value is
specified in milliseconds.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="mapped-reply-headers" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[

View File

@@ -11,6 +11,7 @@
<amqp:outbound-gateway id="rabbitGateway" request-channel="toRabbit"
reply-channel="fromRabbit"
reply-timeout="777"
exchange-name="si.test.exchange"
routing-key="si.test.binding"
amqp-template="amqpTemplate"

View File

@@ -46,6 +46,8 @@ import static org.junit.Assert.assertTrue;
* @author Oleg Zhurakousky
* @author Gary Russell
* @author Artem Bilan
* @author Gunnar Hillert
*
* @since 2.1
*
*/
@@ -62,6 +64,10 @@ public class AmqpOutboundGatewayParserTests {
assertEquals("amqp:outbound-gateway", gateway.getComponentType());
MessageChannel returnChannel = context.getBean("returnChannel", MessageChannel.class);
assertSame(returnChannel, TestUtils.getPropertyValue(gateway, "returnChannel"));
Long sendTimeout = TestUtils.getPropertyValue(gateway, "messagingTemplate.sendTimeout", Long.class);
assertEquals(Long.valueOf(777), sendTimeout);
}
@SuppressWarnings("rawtypes")