INT-2822: 'requires-reply' for Outbound Gateways
* Add `requires-reply` attribute for all adapters outbound gateways as `true` by default * WS-outbound-gateway is still without it, because it has its own specific attribute `ignore-empty-responses` * Make `requires-reply` as `false` by default for `jdbc:stored-proc-outbound-gateway` inasmuch as `jdbc:stored-proc-outbound-adapter` doesn't have ability to configure `returning-resultset` * add parser tests for `requires-reply` JIRA: https://jira.springsource.org/browse/INT-2822 INT-2822 'requires-reply' for ws:outbound-gateway Default false. INT-2822: Polishing after rebase INT-2822: deprecate 'ignore-empty-responses' * Add 'requires-reply' section into What's New INT-2822: remove 'ignore-empty-responses' from RM INT-2822: Polishing after rebase INT-2822: Rebased and polished INT-2822: Rebased and polished Add WARN within deprecated `AbstractWebServiceOutboundGateway#setIgnoreEmptyResponses` Revert 'ignore-empty-responses'; Doc Polishing
This commit is contained in:
committed by
Gary Russell
parent
b8980d4064
commit
70886b2543
@@ -83,6 +83,7 @@ public class WebServiceOutboundGatewayParser extends AbstractOutboundGatewayPars
|
||||
}
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout", "sendTimeout");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "requires-reply");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-empty-responses");
|
||||
this.postProcessGateway(builder, element, parserContext);
|
||||
|
||||
|
||||
@@ -87,6 +87,16 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="requires-reply" type="xsd:string" use="optional" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Specify whether this outbound gateway must return a non-null value. This value is
|
||||
'false' by default, otherwise a ReplyRequiredException will be thrown when
|
||||
the underlying service returns a null value, or an empty String (if
|
||||
'ignore-empty-responses' is 'true').
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="uri" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
@@ -139,7 +149,9 @@
|
||||
<xsd:attribute name="ignore-empty-responses" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether empty String response payloads should be ignored. The default is TRUE.
|
||||
Indicates whether empty String response payloads should be considered as null. The default is TRUE.
|
||||
See also 'requires-reply'. Note that when 'requires-reply' is 'true' the response is not actually 'ignored',
|
||||
because it will cause a ReplyRequiredException to be thrown.
|
||||
Set this to FALSE if you want to send empty String responses in reply Messages.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
@@ -456,4 +468,4 @@ this list can also be simple patterns to be matched against the header names (e.
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:schema>
|
||||
</xsd:schema>
|
||||
|
||||
@@ -17,13 +17,15 @@
|
||||
package org.springframework.integration.ws.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -72,6 +74,7 @@ public class WebServiceOutboundGatewayParserTests {
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
|
||||
Object expected = context.getBean("outputChannel");
|
||||
assertEquals(expected, accessor.getPropertyValue("outputChannel"));
|
||||
Assert.assertEquals(Boolean.FALSE, accessor.getPropertyValue("requiresReply"));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> requestHeaders = TestUtils.getPropertyValue(endpoint, "handler.headerMapper.requestHeaderNames", List.class);
|
||||
@@ -96,18 +99,20 @@ public class WebServiceOutboundGatewayParserTests {
|
||||
assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass());
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
|
||||
assertEquals(Boolean.TRUE, accessor.getPropertyValue("ignoreEmptyResponses"));
|
||||
Assert.assertEquals(Boolean.FALSE, accessor.getPropertyValue("requiresReply"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleGatewayWithIgnoreEmptyResponses() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"simpleWebServiceOutboundGatewayParserTests.xml", this.getClass());
|
||||
AbstractEndpoint endpoint = (AbstractEndpoint) context.getBean("gatewayWithIgnoreEmptyResponsesFalse");
|
||||
AbstractEndpoint endpoint = (AbstractEndpoint) context.getBean("gatewayWithIgnoreEmptyResponsesFalseAndRequiresReplyTrue");
|
||||
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
|
||||
Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler");
|
||||
assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass());
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
|
||||
assertEquals(Boolean.FALSE, accessor.getPropertyValue("ignoreEmptyResponses"));
|
||||
Assert.assertEquals(Boolean.TRUE, accessor.getPropertyValue("requiresReply"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -31,10 +31,11 @@
|
||||
mapped-request-headers="testRequest"
|
||||
mapped-reply-headers="testReply"/>
|
||||
|
||||
<ws:outbound-gateway id="gatewayWithIgnoreEmptyResponsesFalse"
|
||||
<ws:outbound-gateway id="gatewayWithIgnoreEmptyResponsesFalseAndRequiresReplyTrue"
|
||||
request-channel="inputChannel"
|
||||
uri="http://example.org"
|
||||
ignore-empty-responses="false"/>
|
||||
ignore-empty-responses="false"
|
||||
requires-reply="true"/>
|
||||
|
||||
<ws:outbound-gateway id="gatewayWithDefaultSourceExtractor"
|
||||
request-channel="inputChannel"
|
||||
|
||||
Reference in New Issue
Block a user