From b07abcd30ca23a30755dfa6dd24cdb06182e01f3 Mon Sep 17 00:00:00 2001 From: Gunnar Hillert Date: Wed, 11 Jul 2012 15:58:50 -0400 Subject: [PATCH] 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 --- .../config/AmqpOutboundGatewayParser.java | 15 +-- .../config/spring-integration-amqp-2.2.xsd | 23 +++++ ...AmqpOutboundGatewayParserTests-context.xml | 1 + .../AmqpOutboundGatewayParserTests.java | 6 ++ ...stractRemoteFileOutboundGatewayParser.java | 9 +- .../config/FileOutboundGatewayParser.java | 5 +- .../config/spring-integration-file-2.2.xsd | 23 +++++ ...FileOutboundGatewayParserTests-context.xml | 1 + .../FileOutboundGatewayParserTests.java | 4 + .../ftp/config/spring-integration-ftp-2.2.xsd | 23 +++++ .../FtpOutboundGatewayParserTests-context.xml | 1 + .../config/FtpOutboundGatewayParserTests.java | 7 +- .../config/spring-integration-http-2.2.xsd | 30 +++--- .../ip/config/spring-integration-ip-2.1.xsd | 24 ++++- .../ip/config/spring-integration-ip-2.2.xsd | 26 ++++-- .../config/spring-integration-jdbc-2.2.xsd | 50 ++++++---- .../jms/config/spring-integration-jms-2.2.xsd | 92 +++++++++++-------- .../config/xml/spring-integration-jpa-2.2.xsd | 25 +++-- .../config/spring-integration-sftp-2.2.xsd | 23 +++++ ...SftpOutboundGatewayParserTests-context.xml | 1 + .../SftpOutboundGatewayParserTests.java | 7 +- .../WebServiceOutboundGatewayParser.java | 13 ++- .../ws/config/spring-integration-ws-2.2.xsd | 41 +++++++-- .../WebServiceOutboundGatewayParserTests.java | 16 ++-- ...leWebServiceOutboundGatewayParserTests.xml | 11 ++- src/reference/docbook/whats-new.xml | 14 +++ 26 files changed, 374 insertions(+), 117 deletions(-) diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpOutboundGatewayParser.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpOutboundGatewayParser.java index 0a712647eb..7c1c95e919 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpOutboundGatewayParser.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpOutboundGatewayParser.java @@ -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; } diff --git a/spring-integration-amqp/src/main/resources/org/springframework/integration/amqp/config/spring-integration-amqp-2.2.xsd b/spring-integration-amqp/src/main/resources/org/springframework/integration/amqp/config/spring-integration-amqp-2.2.xsd index 0fc9088015..9871a16ea4 100644 --- a/spring-integration-amqp/src/main/resources/org/springframework/integration/amqp/config/spring-integration-amqp-2.2.xsd +++ b/spring-integration-amqp/src/main/resources/org/springframework/integration/amqp/config/spring-integration-amqp-2.2.xsd @@ -161,6 +161,29 @@ + + + + + + + + + + diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileOutboundGatewayParserTests-context.xml b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileOutboundGatewayParserTests-context.xml index 61ac006886..0617fb6b78 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileOutboundGatewayParserTests-context.xml +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileOutboundGatewayParserTests-context.xml @@ -15,6 +15,7 @@ + + + + + diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests-context.xml index e88d9edc85..b5dd3c5fae 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests-context.xml @@ -16,6 +16,7 @@ session-factory="sf" request-channel="inbound1" reply-channel="outbound" + reply-timeout="777" auto-create-local-directory="false" auto-startup="false" cache-sessions="false" diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests.java index 80815cfaea..33f67bcf1d 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests.java @@ -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. @@ -35,6 +35,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * @author Gary Russell + * @author Gunnar Hillert + * * @since 2.1 * */ @@ -63,6 +65,9 @@ public class FtpOutboundGatewayParserTests { Set options = TestUtils.getPropertyValue(gateway, "options", Set.class); assertTrue(options.contains("-1")); assertTrue(options.contains("-f")); + + Long sendTimeout = TestUtils.getPropertyValue(gateway, "messagingTemplate.sendTimeout", Long.class); + assertEquals(Long.valueOf(777), sendTimeout); } @Test diff --git a/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.2.xsd b/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.2.xsd index cdbf33b3c1..75902c0f34 100644 --- a/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.2.xsd +++ b/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.2.xsd @@ -411,7 +411,7 @@ The String "HTTP_REQUEST_HEADERS" will match against any of the standard HTTP Re - The expected type to which the response body should be converted. + The expected type to which the response body should be converted. Default is 'org.springframework.http.ResponseEntity'. This attribute cannot be provided if expected-response-type-expression has a value @@ -607,7 +607,7 @@ The String "HTTP_REQUEST_HEADERS" will match against any of the standard HTTP Re - The expected type to which the response body should be converted. + The expected type to which the response body should be converted. Default is 'org.springframework.http.ResponseEntity'. This attribute cannot be provided if expected-response-type-expression has a value @@ -671,17 +671,25 @@ The String "HTTP_REQUEST_HEADERS" will match against any of the standard HTTP Re - + diff --git a/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.1.xsd b/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.1.xsd index 92592f47a0..5dde3c0765 100644 --- a/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.1.xsd +++ b/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.1.xsd @@ -330,7 +330,29 @@ task executors such as a WorkManagerTaskExecutor. - + + + + + diff --git a/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.2.xsd b/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.2.xsd index a31a2bd95b..16df61d304 100644 --- a/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.2.xsd +++ b/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.2.xsd @@ -339,15 +339,29 @@ task executors such as a WorkManagerTaskExecutor. - - Specifies the time the gateway will wait while sending - the reply to the reply channel; only applies when the - channel might block (such as a bounded queue channel that - is currently full). + + ]]> diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-2.2.xsd b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-2.2.xsd index ae8c3bed9a..46198b45a6 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-2.2.xsd +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-2.2.xsd @@ -452,14 +452,23 @@ - + 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. + ]]> @@ -916,14 +925,23 @@ - + 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. + ]]> diff --git a/spring-integration-jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-2.2.xsd b/spring-integration-jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-2.2.xsd index 650c194312..62ae297da3 100644 --- a/spring-integration-jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-2.2.xsd +++ b/spring-integration-jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-2.2.xsd @@ -133,7 +133,7 @@ ID for this channel. Required. - + @@ -393,7 +393,7 @@ A reference to a javax.jms.Destination by bean name. As an alternative to a bean reference, use 'destination-name' and 'pub-sub-domain' which will rely upon the - DestinationResolver strategy (DynamicDestinationResolver by default). + DestinationResolver strategy (DynamicDestinationResolver by default). @@ -406,9 +406,9 @@ - The boolean property used to configure the JmsTemplate with knowledge of what JMS domain is being used. By default the value of this property is 'false'', - indicating that the point-to-point domain, Queues, will be used. This property used by JmsTemplate determines the behavior of dynamic destination resolution - via implementations of the DestinationResolver interface. + The boolean property used to configure the JmsTemplate with knowledge of what JMS domain is being used. By default the value of this property is 'false'', + indicating that the point-to-point domain, Queues, will be used. This property used by JmsTemplate determines the behavior of dynamic destination resolution + via implementations of the DestinationResolver interface. @@ -418,17 +418,17 @@ Boolean property indicating whether to make the subscription durable. The durable subscription name to be used can be specified through the "durableSubscriptionName" property. Default is "false". Set this to "true" to register a durable subscription, typically in combination with a "durableSubscriptionName" value (unless your message listener class name is good enough as - subscription name). Only makes sense when listening to a topic (pub-sub domain). + subscription name). Only makes sense when listening to a topic (pub-sub domain). - + The name of a durable subscription to create. To be applied in case of a topic (pub-sub domain) with subscription durability activated. The durable subscription name needs to be unique within this client's JMS client id. Default is the class name of the specified message listener. Note: Only 1 concurrent consumer (which is the default of this message listener container) is allowed - for each durable subscription. + for each durable subscription. @@ -440,7 +440,7 @@ hasn't already assigned one. - + @@ -486,11 +486,11 @@ - + - + - + @@ -513,7 +513,7 @@ A reference to a javax.jms.Destination by bean name. As an alternative to a bean reference, use 'destination-name' and 'pub-sub-domain' which will rely upon the - DestinationResolver strategy (DynamicDestinationResolver by default). + DestinationResolver strategy (DynamicDestinationResolver by default). @@ -579,7 +579,7 @@ A reference to a javax.jms.Destination by bean name. As an alternative to a bean reference, use 'request-destination-name' and 'request-pub-sub-domain' which will rely - upon the DestinationResolver strategy (DynamicDestinationResolver by default). + upon the DestinationResolver strategy (DynamicDestinationResolver by default). @@ -595,7 +595,7 @@ A reference to a javax.jms.Destination by bean name. As an alternative to a bean reference, use either 'default-reply-queue-name' or 'default-reply-topic-name' which - will rely upon the DestinationResolver strategy (DynamicDestinationResolver by default). + will rely upon the DestinationResolver strategy (DynamicDestinationResolver by default). @@ -614,7 +614,7 @@ JMSMessageID from the request will be copied into the JMSCorrelationID of the reply unless there is already a value in the JMSCorrelationID property of the newly created reply Message in which case nothing will be copied. If the JMSCorrelationID of the - request Message should be copied into the JMSCorrelationID of the reply Message + request Message should be copied into the JMSCorrelationID of the reply Message instead, then this value should be set to "JMSCorrelationID". Any other value will be treated as a JMS String Property to be copied as-is from the request Message into the reply Message with the same property name. @@ -628,7 +628,7 @@ - Allows to specify custom implementation of JmsHeaderMapper to map Message Headers to JMS Message. + Allows to specify custom implementation of JmsHeaderMapper to map Message Headers to JMS Message. @@ -665,7 +665,7 @@ If a (synchronous) downstream exception is thrown and an "error-channel" is specified, the MessagingException will be sent to this channel; any response from - which will be returned as a reply by the gateway. If an "error-channel" is not + which will be returned as a reply by the gateway. If an "error-channel" is not supplied, any such exception will be propagated to the listener container and any JMS transaction will be rolled back. Any synchronous downstream exceptions in the error flow will @@ -688,17 +688,17 @@ Boolean property indicating whether to make the subscription durable. The durable subscription name to be used can be specified through the "durableSubscriptionName" property. Default is "false". Set this to "true" to register a durable subscription, typically in combination with a "durableSubscriptionName" value (unless your message listener class name is good enough as - subscription name). Only makes sense when listening to a topic (pub-sub domain). + subscription name). Only makes sense when listening to a topic (pub-sub domain). - + The name of a durable subscription to create. To be applied in case of a topic (pub-sub domain) with subscription durability activated. The durable subscription name needs to be unique within this client's JMS client id. Default is the class name of the specified message listener. Note: Only 1 concurrent consumer (which is the default of this message listener container) is allowed - for each durable subscription. + for each durable subscription. @@ -712,9 +712,9 @@ - + - + @@ -756,15 +756,31 @@ - Timeout for the JMS MessageConsumer to receive the JMS reply Message. Default is 5 seconds. + Timeout for the JMS MessageConsumer to receive the JMS reply Message. Default is 5 seconds. - - Timeout for sending the mapped integration Message to this gateway's reply-channel. Default is indefinite. - + @@ -801,13 +817,13 @@ This attribute is mutually exclusive with 'request-destination' and 'request-destination-name'. - + When resolving a request destination name (rather than having a 'request-destination' reference), a true value here specifies that the DestinationResolver should resolve Topics rather than Queues. - Default is false. + Default is false. @@ -816,7 +832,7 @@ A reference to a javax.jms.Destination by bean name. As an alternative to a bean reference, use 'reply-destination-name' and 'reply-pub-sub-domain' which will rely - upon the DestinationResolver strategy (DynamicDestinationResolver by default). + upon the DestinationResolver strategy (DynamicDestinationResolver by default). @@ -880,7 +896,7 @@ - Allows to specify custom implementation of JmsHeaderMapper to map Message Headers to JMS Message. + Allows to specify custom implementation of JmsHeaderMapper to map Message Headers to JMS Message. @@ -1157,12 +1173,12 @@ Specify the default boolean value for whether to overwrite existing header values. This will only take effect for sub-elements that do not provide their own 'overwrite' attribute. If the 'default-overwrite' attribute is not - provided, then the specified header values will NOT overwrite any existing ones with the same header names. + provided, then the specified header values will NOT overwrite any existing ones with the same header names. - + @@ -1254,7 +1270,7 @@ - + @@ -1304,11 +1320,11 @@ Specify the maximum number of messages to process in one task. More concretely, this limits the number of message reception attempts per task, which includes receive iterations that did not actually - pick up a message until they hit their timeout + pick up a message until they hit their timeout - + @@ -1335,11 +1351,11 @@ received any message within its execution. If this limit is reached, the task will shut down and leave receiving to other executing tasks. The default is 1, closing idle resources early once a task didn't - receive a message. + receive a message. - + \ No newline at end of file diff --git a/spring-integration-jpa/src/main/resources/org/springframework/integration/jpa/config/xml/spring-integration-jpa-2.2.xsd b/spring-integration-jpa/src/main/resources/org/springframework/integration/jpa/config/xml/spring-integration-jpa-2.2.xsd index cca2925289..a3b3fcb6b3 100644 --- a/spring-integration-jpa/src/main/resources/org/springframework/integration/jpa/config/xml/spring-integration-jpa-2.2.xsd +++ b/spring-integration-jpa/src/main/resources/org/springframework/integration/jpa/config/xml/spring-integration-jpa-2.2.xsd @@ -319,14 +319,23 @@ - + 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. + ]]> diff --git a/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.2.xsd b/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.2.xsd index 3e351087f6..5aa3f7d624 100644 --- a/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.2.xsd +++ b/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.2.xsd @@ -332,6 +332,29 @@ + + + + + diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests-context.xml index a73c32a55d..32baa477af 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests-context.xml @@ -16,6 +16,7 @@ session-factory="sf" request-channel="inbound1" reply-channel="outbound" + reply-timeout="777" auto-create-local-directory="false" auto-startup="false" cache-sessions="false" diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests.java index 8b0aaa217f..60b246ae02 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests.java @@ -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. @@ -35,6 +35,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * @author Gary Russell + * @author Gunnar Hillert + * * @since 2.1 * */ @@ -63,6 +65,9 @@ public class SftpOutboundGatewayParserTests { Set options = TestUtils.getPropertyValue(gateway, "options", Set.class); assertTrue(options.contains("-1")); assertTrue(options.contains("-f")); + + Long sendTimeout = TestUtils.getPropertyValue(gateway, "messagingTemplate.sendTimeout", Long.class); + assertEquals(Long.valueOf(777), sendTimeout); } @Test diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParser.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParser.java index d0c4eab75d..d804af4968 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParser.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParser.java @@ -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. @@ -34,10 +34,12 @@ import org.springframework.util.StringUtils; import org.springframework.util.xml.DomUtils; /** - * Parser for the <outbound-gateway/> element in the 'ws' namespace. - * + * Parser for the <outbound-gateway/> element in the 'ws' namespace. + * * @author Mark Fisher * @author Jonas Partner + * @author Gunnar Hillert + * */ public class WebServiceOutboundGatewayParser extends AbstractOutboundGatewayParser { @@ -83,11 +85,12 @@ public class WebServiceOutboundGatewayParser extends AbstractOutboundGatewayPars } } IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout", "sendTimeout"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-empty-responses"); this.postProcessGateway(builder, element, parserContext); - + IntegrationNamespaceUtils.configureHeaderMapper(element, builder, parserContext, DefaultSoapHeaderMapper.class, null); - + return builder; } diff --git a/spring-integration-ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-2.2.xsd b/spring-integration-ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-2.2.xsd index a43efcf31f..1e20f1bf66 100644 --- a/spring-integration-ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-2.2.xsd +++ b/spring-integration-ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-2.2.xsd @@ -63,6 +63,29 @@ + + + + + - + @@ -137,7 +160,7 @@ Reference to a Spring Web Services WebServiceMessageCallback. This enables changing the Web Service request message after the payload has been written to it but prior - to invocation of the actual Web Service. + to invocation of the actual Web Service. @@ -209,7 +232,7 @@ Reference to a HeaderMapper<SoapHeader> implementation that this gateway will use to map between Spring Integration - MessageHeaders and the SoapHeader. + MessageHeaders and the SoapHeader. @@ -229,7 +252,7 @@ - If a (synchronous) downstream exception is thrown and an error-channel is specified, - the MessagingException will be sent to this channel. + the MessagingException will be sent to this channel. @@ -335,7 +358,7 @@ this list can also be simple patterns to be matched against the header names (e. Reference to a HeaderMapper<SoapHeader> implementation that this gateway will use to map between Spring Integration - MessageHeaders and the SoapHeader. + MessageHeaders and the SoapHeader. @@ -355,7 +378,7 @@ this list can also be simple patterns to be matched against the header names (e. - Specify the default boolean value for whether to overwrite existing header values. This will only take effect for sub-elements that do not provide their own 'overwrite' attribute. If the 'default-overwrite' attribute is not - provided, then the specified header values will NOT overwrite any existing ones with the same header names. + provided, then the specified header values will NOT overwrite any existing ones with the same header names. - + diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParserTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParserTests.java index 96d6d0dc41..472a98075e 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParserTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParserTests.java @@ -48,6 +48,7 @@ import static org.junit.Assert.assertNull; /** * @author Mark Fisher * @author Oleg Zhurakousky + * @author Gunnar Hillert */ public class WebServiceOutboundGatewayParserTests { @@ -71,6 +72,9 @@ public class WebServiceOutboundGatewayParserTests { assertEquals(1, replyHeaders.size()); assertTrue(requestHeaders.contains("testRequest")); assertTrue(replyHeaders.contains("testReply")); + + Long sendTimeout = TestUtils.getPropertyValue(gateway, "messagingTemplate.sendTimeout", Long.class); + assertEquals(Long.valueOf(777), sendTimeout); } @Test @@ -179,7 +183,7 @@ public class WebServiceOutboundGatewayParserTests { assertEquals(resolver, accessor.getPropertyValue("faultMessageResolver")); } - + @Test public void simpleGatewayWithCustomMessageSender() { ApplicationContext context = new ClassPathXmlApplicationContext( @@ -188,7 +192,7 @@ public class WebServiceOutboundGatewayParserTests { assertEquals(EventDrivenConsumer.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler"); assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass()); - DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); + DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate")); WebServiceMessageSender messageSender = (WebServiceMessageSender) context.getBean("messageSender"); assertEquals(messageSender, ((WebServiceMessageSender[])accessor.getPropertyValue("messageSenders"))[0]); @@ -217,7 +221,7 @@ public class WebServiceOutboundGatewayParserTests { assertEquals(EventDrivenConsumer.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler"); assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass()); - DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); + DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate")); ClientInterceptor interceptor = context.getBean("interceptor", ClientInterceptor.class); assertEquals(interceptor, ((ClientInterceptor[]) accessor.getPropertyValue("interceptors"))[0]); @@ -318,7 +322,7 @@ public class WebServiceOutboundGatewayParserTests { Marshaller marshaller = (Marshaller) context.getBean("marshallerAndUnmarshaller"); assertEquals(marshaller, TestUtils.getPropertyValue(gateway, "marshaller", Marshaller.class)); assertEquals(marshaller, TestUtils.getPropertyValue(gateway, "unmarshaller", Unmarshaller.class)); - + WebServiceMessageFactory messageFactory = (WebServiceMessageFactory) context.getBean("messageFactory"); assertEquals(messageFactory, TestUtils.getPropertyValue(gateway, "webServiceTemplate.messageFactory")); } @@ -330,7 +334,7 @@ public class WebServiceOutboundGatewayParserTests { AbstractEndpoint endpoint = (AbstractEndpoint) context.getBean("gatewayWithSeparateMarshallerAndUnmarshallerAndMessageFactory"); assertEquals(EventDrivenConsumer.class, endpoint.getClass()); MarshallingWebServiceOutboundGateway gateway = (MarshallingWebServiceOutboundGateway) new DirectFieldAccessor(endpoint).getPropertyValue("handler"); - + Marshaller marshaller = (Marshaller) context.getBean("marshaller"); Unmarshaller unmarshaller = (Unmarshaller) context.getBean("unmarshaller"); assertEquals(marshaller, TestUtils.getPropertyValue(gateway, "marshaller", Marshaller.class)); @@ -365,5 +369,5 @@ public class WebServiceOutboundGatewayParserTests { public void invalidGatewayWithNeitherUriNorDestinationProvider() { new ClassPathXmlApplicationContext("invalidGatewayWithNeitherUriNorDestinationProvider.xml", this.getClass()); } - + } diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceOutboundGatewayParserTests.xml b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceOutboundGatewayParserTests.xml index 30c40de475..3d49c505ec 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceOutboundGatewayParserTests.xml +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceOutboundGatewayParserTests.xml @@ -10,7 +10,7 @@ http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/integration/ws http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd - http://www.springframework.org/schema/util + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> @@ -27,6 +27,7 @@ request-channel="inputChannel" uri="http://example.org" reply-channel="outputChannel" + reply-timeout="777" mapped-request-headers="testRequest" mapped-reply-headers="testReply"/> @@ -64,12 +65,12 @@ request-channel="inputChannel" uri="http://example.org" fault-message-resolver="faultMessageResolver"/> - + - + - + - + diff --git a/src/reference/docbook/whats-new.xml b/src/reference/docbook/whats-new.xml index 767eac8523..f23a6450e8 100644 --- a/src/reference/docbook/whats-new.xml +++ b/src/reference/docbook/whats-new.xml @@ -18,6 +18,20 @@ Spring Integration now uses Spring 3.1. +
+ Outbound Gateways + + The XML Namespace support adds the reply-timeout + attribute to the following Outbound Gateways: + + + Amqp Outbound Gateway + File Outbound Gateway + Ftp Outbound Gateway + Sftp Outbound Gateway + Ws Outbound Gateway + +
Spring-AMQP 1.1