INT-4100: Improve RequestReplyExchanger

JIRA: https://jira.spring.io/browse/INT-4100

* Add `throws MessagingException` to the `RequestReplyExchanger` to make it fully messaging contract based
* Add test to the `ServiceActivatorDefaultFrameworkMethodTests` to demonstrate how many info is in the stack trace after `RequestReplyExchanger`
* Document how to be with the `throws` clause in custom gateways
* Fix `boolean` attributes in the `spring-integration-5.0.xsd`

* Fix `AbstractChannelAdapterParser` do not populate endpoint attributes if component is nested
* Fix typo in the `AmqpOutboundChannelAdapterParserTests`
* Increase timeouts in the  `MixedDispatcherConfigurationScenarioTests`

Reinstate `auto-startup` to none by default.
 Not all components expects `true` by default in their initial state

Also https://jira.spring.io/browse/INT-3432

Document the behavior of the `throws` clause on gateway method

Remove unrelated `bridge` id from the `<chain>`

Add What's new about  `RequestReplyExchanger` changes

Doc Polishing.
This commit is contained in:
Artem Bilan
2017-03-02 15:31:45 -05:00
committed by Gary Russell
parent 10ce68d3e3
commit 8da89c7cce
9 changed files with 126 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 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.
@@ -65,20 +65,22 @@ public abstract class AbstractChannelAdapterParser extends AbstractBeanDefinitio
}
AbstractBeanDefinition beanDefinition = doParse(element, parserContext, channelName);
MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
String autoStartup = element.getAttribute(IntegrationNamespaceUtils.AUTO_STARTUP);
if (StringUtils.hasText(autoStartup)) {
propertyValues.add("autoStartup", new TypedStringValue(autoStartup));
}
String phase = element.getAttribute(IntegrationNamespaceUtils.PHASE);
if (StringUtils.hasText(phase)) {
propertyValues.add("phase", new TypedStringValue(phase));
}
String role = element.getAttribute(IntegrationNamespaceUtils.ROLE);
if (StringUtils.hasText(role)) {
if (!StringUtils.hasText(element.getAttribute(ID_ATTRIBUTE))) {
parserContext.getReaderContext().error("When using 'role', 'id' is required", element);
if (!parserContext.isNested()) {
String autoStartup = element.getAttribute(IntegrationNamespaceUtils.AUTO_STARTUP);
if (StringUtils.hasText(autoStartup)) {
propertyValues.add("autoStartup", new TypedStringValue(autoStartup));
}
String phase = element.getAttribute(IntegrationNamespaceUtils.PHASE);
if (StringUtils.hasText(phase)) {
propertyValues.add("phase", new TypedStringValue(phase));
}
String role = element.getAttribute(IntegrationNamespaceUtils.ROLE);
if (StringUtils.hasText(role)) {
if (!StringUtils.hasText(element.getAttribute(ID_ATTRIBUTE))) {
parserContext.getReaderContext().error("When using 'role', 'id' is required", element);
}
IntegrationNamespaceUtils.putLifecycleInRole(role, element.getAttribute(ID_ATTRIBUTE), parserContext);
}
IntegrationNamespaceUtils.putLifecycleInRole(role, element.getAttribute(ID_ATTRIBUTE), parserContext);
}
return beanDefinition;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2017 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.
@@ -17,6 +17,7 @@
package org.springframework.integration.gateway;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
/**
* Interface for a request/reply Message exchange. This will be used as a default
@@ -24,11 +25,13 @@ import org.springframework.messaging.Message;
*
* @author Oleg Zhurakousky
* @author Mark Fisher
* @author Artem Bilan
*
* @since 2.0
*/
@FunctionalInterface
public interface RequestReplyExchanger {
Message<?> exchange(Message<?> request);
Message<?> exchange(Message<?> request) throws MessagingException;
}

View File

@@ -182,7 +182,7 @@
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="fixed-subscriber" default="false" type="xsd:boolean">
<xsd:attribute name="fixed-subscriber" default="false">
<xsd:annotation>
<xsd:documentation><![CDATA[
When true, only one subscriber is allowed; the subscriber must be available at context initialization time,
@@ -192,6 +192,9 @@
'message-converter' is not allowed. Default: false.
]]></xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:union memberTypes="xsd:boolean xsd:string" />
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
@@ -1859,7 +1862,11 @@
<xsd:complexContent>
<xsd:extension base="basePollerType">
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="default" type="xsd:boolean" default="false" />
<xsd:attribute name="default" default="false">
<xsd:simpleType>
<xsd:union memberTypes="xsd:boolean xsd:string" />
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
@@ -2904,12 +2911,15 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="throw-exception-on-rejection" type="xsd:string">
<xsd:attribute name="throw-exception-on-rejection" default="false">
<xsd:annotation>
<xsd:documentation>
Throw an exception if the filter rejects the message (default false).
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:union memberTypes="xsd:boolean xsd:string" />
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
@@ -3632,7 +3642,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="expire-groups-upon-completion" type="xsd:string">
<xsd:attribute name="expire-groups-upon-completion" default="false">
<xsd:annotation>
<xsd:documentation>
Boolean flag specifying if MessageGroup should be removed once completed. Useful for
@@ -3640,6 +3650,9 @@
is the same as the completed MessageGroup will be discarded. Default is 'false'
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:union memberTypes="xsd:boolean xsd:string" />
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
@@ -3769,7 +3782,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="expire-groups-upon-timeout" type="xsd:string">
<xsd:attribute name="expire-groups-upon-timeout">
<xsd:annotation>
<xsd:documentation>
Boolean flag specifying, if a group is completed due to timeout (reaper or
@@ -3779,6 +3792,9 @@
resequencer.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:union memberTypes="xsd:boolean xsd:string" />
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="lock-registry" type="xsd:string">
<xsd:annotation>
@@ -4977,12 +4993,15 @@ endpoint itself is a Polling Consumer for a channel with a queue.
</xsd:attributeGroup>
<xsd:attributeGroup name="smartLifeCycleAttributeGroup">
<xsd:attribute name="auto-startup" type="xsd:string">
<xsd:attribute name="auto-startup">
<xsd:annotation>
<xsd:documentation><![CDATA[
Boolean value indicating whether this endpoint should start automatically.
Boolean value indicating whether this endpoint should start automatically.
]]></xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:union memberTypes="xsd:boolean xsd:string" />
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="phase" type="xsd:string">
<xsd:annotation>