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:
committed by
Gary Russell
parent
386be70dda
commit
b07abcd30c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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.
|
||||
@@ -27,10 +27,12 @@ import org.springframework.util.StringUtils;
|
||||
/**
|
||||
* @author Gary Russell
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public abstract class AbstractRemoteFileOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
|
||||
|
||||
@Override
|
||||
protected String getInputChannelAttributeName() {
|
||||
return "request-channel";
|
||||
@@ -44,13 +46,14 @@ public abstract class AbstractRemoteFileOutboundGatewayParser extends AbstractCo
|
||||
BeanDefinitionBuilder sessionFactoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(SessionFactoryFactoryBean.class);
|
||||
sessionFactoryBuilder.addConstructorArgReference(element.getAttribute("session-factory"));
|
||||
sessionFactoryBuilder.addConstructorArgValue(element.getAttribute("cache-sessions"));
|
||||
|
||||
|
||||
builder.addConstructorArgValue(sessionFactoryBuilder.getBeanDefinition());
|
||||
|
||||
builder.addConstructorArgValue(element.getAttribute("command"));
|
||||
builder.addConstructorArgValue(element.getAttribute(EXPRESSION_ATTRIBUTE));
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "command-options", "options");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "temporary-file-suffix");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout", "sendTimeout");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel", "outputChannel");
|
||||
this.configureFilter(builder, element, parserContext);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "remote-file-separator");
|
||||
|
||||
@@ -25,10 +25,12 @@ import org.springframework.integration.config.xml.AbstractConsumerEndpointParser
|
||||
|
||||
/**
|
||||
* Parser for the 'outbound-gateway' element of the file namespace.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Artem Bilan
|
||||
* @author Gunnar Hillert
|
||||
*
|
||||
* @since 1.0.3
|
||||
*/
|
||||
public class FileOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
@@ -41,6 +43,7 @@ public class FileOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
@Override
|
||||
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder handlerBuilder = FileWritingMessageHandlerBeanDefinitionBuilder.configure(element, true, parserContext);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(handlerBuilder, element, "reply-timeout", "sendTimeout");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(handlerBuilder, element, "reply-channel", "outputChannel");
|
||||
return handlerBuilder;
|
||||
}
|
||||
|
||||
@@ -262,6 +262,29 @@ Only files matching this regular expression will be picked up by this adapter.
|
||||
</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:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<outbound-gateway id="ordered"
|
||||
request-channel="someChannel"
|
||||
reply-timeout="777"
|
||||
directory="${java.io.tmpdir}"
|
||||
auto-startup="false"
|
||||
order="777"
|
||||
|
||||
@@ -58,6 +58,10 @@ public class FileOutboundGatewayParserTests {
|
||||
String expression = (String) TestUtils.getPropertyValue(fileNameGenerator, "expression");
|
||||
assertNotNull(expression);
|
||||
assertEquals("'foo.txt'", expression);
|
||||
|
||||
Long sendTimeout = TestUtils.getPropertyValue(handler, "messagingTemplate.sendTimeout", Long.class);
|
||||
assertEquals(Long.valueOf(777), sendTimeout);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user