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.
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,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="uri" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
@@ -85,7 +108,7 @@
|
||||
<tool:expected-type type="org.springframework.ws.client.support.destination.DestinationProvider"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="marshaller" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
@@ -137,7 +160,7 @@
|
||||
<xsd:documentation>
|
||||
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.
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
@@ -209,7 +232,7 @@
|
||||
<xsd:documentation>
|
||||
Reference to a HeaderMapper<SoapHeader> implementation
|
||||
that this gateway will use to map between Spring Integration
|
||||
MessageHeaders and the SoapHeader.
|
||||
MessageHeaders and the SoapHeader.
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
@@ -229,7 +252,7 @@
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="mapped-reply-headers" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
<xsd:documentation><![CDATA[
|
||||
Comma-separated list of names of MessageHeaders to be mapped into the SOAP Headers of the SOAP reply.
|
||||
This can only be provided if the 'header-mapper' reference is not being set directly. The values in
|
||||
this list can also be simple patterns to be matched against the header names (e.g. "foo*" or "*foo").
|
||||
@@ -307,7 +330,7 @@ this list can also be simple patterns to be matched against the header names (e.
|
||||
</xsd:appinfo>
|
||||
<xsd:documentation>
|
||||
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.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
@@ -335,7 +358,7 @@ this list can also be simple patterns to be matched against the header names (e.
|
||||
<xsd:documentation>
|
||||
Reference to a HeaderMapper<SoapHeader> implementation
|
||||
that this gateway will use to map between Spring Integration
|
||||
MessageHeaders and the SoapHeader.
|
||||
MessageHeaders and the SoapHeader.
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
@@ -355,7 +378,7 @@ this list can also be simple patterns to be matched against the header names (e.
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="mapped-reply-headers" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
<xsd:documentation><![CDATA[
|
||||
Comma-separated list of names of MessageHeaders to be mapped into the SOAP Headers of the SOAP reply.
|
||||
This can only be provided if the 'header-mapper' reference is not being set directly. The values in
|
||||
this list can also be simple patterns to be matched against the header names (e.g. "foo*" or "*foo").
|
||||
@@ -382,12 +405,12 @@ this list can also be simple patterns to be matched against the header names (e.
|
||||
<xsd:documentation>
|
||||
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.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:union memberTypes="xsd:boolean xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
<si:channel id="inputChannel"/>
|
||||
@@ -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"/>
|
||||
|
||||
|
||||
<ws:outbound-gateway id="gatewayWithCustomMessageSender"
|
||||
request-channel="inputChannel"
|
||||
uri="http://example.org"
|
||||
message-sender="messageSender"/>
|
||||
|
||||
|
||||
<ws:outbound-gateway id="gatewayWithCustomMessageSenderList"
|
||||
request-channel="inputChannel"
|
||||
uri="http://example.org"
|
||||
@@ -79,12 +80,12 @@
|
||||
request-channel="inputChannel"
|
||||
uri="http://example.org"
|
||||
interceptor="interceptor"/>
|
||||
|
||||
|
||||
<ws:outbound-gateway id="gatewayWithCustomInterceptorList"
|
||||
request-channel="inputChannel"
|
||||
uri="http://example.org"
|
||||
interceptors="interceptors"/>
|
||||
|
||||
|
||||
<ws:outbound-gateway id="gatewayWithPoller"
|
||||
request-channel="pollableInputChannel"
|
||||
uri="http://example.org">
|
||||
|
||||
Reference in New Issue
Block a user