Skip to content

Commit

Permalink
INT-3379 - Allow Placeholders for Enums
Browse files Browse the repository at this point in the history
JIRA: https://jira.spring.io/browse/INT-3379

Change enumerated attributes to a union with xsd:string
to allow placeholders.

JMS and XML deferred to 4.1 due to the amount of
changes needed to the parsers. See INT-3384.
  • Loading branch information
garyrussell committed Apr 23, 2014
1 parent d2f3aa9 commit aeeb9db
Show file tree
Hide file tree
Showing 13 changed files with 236 additions and 164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -684,15 +684,13 @@ standard headers to also be mapped.
<xsd:attribute name="acknowledge-mode">
<xsd:annotation>
<xsd:documentation>
Acknowledge Mode for the MessageListenerContainer.
Acknowledge Mode for the MessageListenerContainer; default 'AUTO'
meaning the adapter automatically acknowledges the message(s)
according to the tx-size.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AUTO"/>
<xsd:enumeration value="MANUAL"/>
<xsd:enumeration value="NONE"/>
</xsd:restriction>
<xsd:union memberTypes="ackModeEnumeration xsd:string"/>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="advice-chain" type="xsd:string">
Expand Down Expand Up @@ -826,4 +824,12 @@ standard headers to also be mapped.
<xsd:attributeGroup ref="integration:smartLifeCycleAttributeGroup"/>
</xsd:attributeGroup>

<xsd:simpleType name="ackModeEnumeration">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AUTO"/>
<xsd:enumeration value="MANUAL"/>
<xsd:enumeration value="NONE"/>
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@
xmlns:amqp="http://www.springframework.org/schema/integration/amqp"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration/amqp http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

<context:property-placeholder properties-ref="props"/>

<util:properties id="props">
<prop key="ackMode">NONE</prop>
</util:properties>

<amqp:inbound-channel-adapter id="rabbitInbound" queue-names="inboundchanneladapter.test.1"/>

<amqp:inbound-channel-adapter id="autoStartFalse" queue-names="inboundchanneladapter.test.2"
auto-startup="false" phase="123"/>
auto-startup="false" phase="123" acknowledge-mode="${ackMode}"/>

<amqp:inbound-channel-adapter id="withHeaderMapperStandardAndCustomHeaders" channel="requestChannel" queue-names="inboundchanneladapter.test.2"
auto-startup="false" phase="123"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.core.MessageProperties;
Expand Down Expand Up @@ -67,6 +68,7 @@ public void verifyLifeCycle() {
Object adapter = context.getBean("autoStartFalse.adapter");
assertEquals(Boolean.FALSE, TestUtils.getPropertyValue(adapter, "autoStartup"));
assertEquals(123, TestUtils.getPropertyValue(adapter, "phase"));
assertEquals(AcknowledgeMode.NONE, TestUtils.getPropertyValue(adapter, "messageListenerContainer.acknowledgeMode"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,28 +334,7 @@
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="round-robin">
<xsd:annotation>
<xsd:documentation>
[DEFAULT] Defines a Round Robin dispatching strategy which allows
load balancing of messages
between multiple Message Handlers. Which
message
handler receives the message first is determined by the 'order'
attribute
of such Message Handler.
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="none">
<xsd:annotation>
<xsd:documentation>
No LoadBalancingStrategy will be used.
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
<xsd:union memberTypes="loadBalancerEnumeration xsd:string"/>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="failover" type="xsd:string">
Expand Down Expand Up @@ -404,6 +383,31 @@
<xsd:attributeGroup ref="subscribersAttributeGroup" />
</xsd:complexType>

<xsd:simpleType name="loadBalancerEnumeration">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="round-robin">
<xsd:annotation>
<xsd:documentation>
[DEFAULT] Defines a Round Robin dispatching strategy which allows
load balancing of messages
between multiple Message Handlers. Which
message
handler receives the message first is determined by the 'order'
attribute
of such Message Handler.
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="none">
<xsd:annotation>
<xsd:documentation>
No LoadBalancingStrategy will be used.
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>

<xsd:element name="publish-subscribe-channel">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -1751,10 +1755,7 @@
]]></xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="MILLISECONDS" />
<xsd:enumeration value="SECONDS" />
</xsd:restriction>
<xsd:union memberTypes="timeUnitEnumeration xsd:string"/>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="cron" type="xsd:string">
Expand Down Expand Up @@ -1793,6 +1794,13 @@
</xsd:attribute>
</xsd:complexType>

<xsd:simpleType name="timeUnitEnumeration">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="MILLISECONDS" />
<xsd:enumeration value="SECONDS" />
</xsd:restriction>
</xsd:simpleType>

<xsd:element name="selector-chain">
<xsd:complexType>
<xsd:annotation>
Expand All @@ -1812,17 +1820,21 @@
]]></xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="ALL" />
<xsd:enumeration value="ANY" />
<xsd:enumeration value="MAJORITY" />
<xsd:enumeration value="MAJORITY_OR_TIE" />
</xsd:restriction>
<xsd:union memberTypes="votingStrategyEnumeration xsd:string"/>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>

<xsd:simpleType name="votingStrategyEnumeration">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="ALL" />
<xsd:enumeration value="ANY" />
<xsd:enumeration value="MAJORITY" />
<xsd:enumeration value="MAJORITY_OR_TIE" />
</xsd:restriction>
</xsd:simpleType>

<xsd:element name="selector">
<xsd:complexType>
<xsd:complexContent>
Expand Down Expand Up @@ -3687,15 +3699,7 @@
]]></xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="REQUIRED" />
<xsd:enumeration value="SUPPORTS" />
<xsd:enumeration value="MANDATORY" />
<xsd:enumeration value="REQUIRES_NEW" />
<xsd:enumeration value="NOT_SUPPORTED" />
<xsd:enumeration value="NEVER" />
<xsd:enumeration value="NESTED" />
</xsd:restriction>
<xsd:union memberTypes="propagationEnumeration xsd:string"/>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="isolation" default="DEFAULT">
Expand All @@ -3705,13 +3709,7 @@
]]></xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="DEFAULT" />
<xsd:enumeration value="READ_UNCOMMITTED" />
<xsd:enumeration value="READ_COMMITTED" />
<xsd:enumeration value="REPEATABLE_READ" />
<xsd:enumeration value="SERIALIZABLE" />
</xsd:restriction>
<xsd:union memberTypes="isolationEnumeration xsd:string"/>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="timeout" type="xsd:string" default="-1">
Expand Down Expand Up @@ -3743,6 +3741,28 @@
</xsd:attribute>
</xsd:complexType>

<xsd:simpleType name="propagationEnumeration">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="REQUIRED" />
<xsd:enumeration value="SUPPORTS" />
<xsd:enumeration value="MANDATORY" />
<xsd:enumeration value="REQUIRES_NEW" />
<xsd:enumeration value="NOT_SUPPORTED" />
<xsd:enumeration value="NEVER" />
<xsd:enumeration value="NESTED" />
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="isolationEnumeration">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="DEFAULT" />
<xsd:enumeration value="READ_UNCOMMITTED" />
<xsd:enumeration value="READ_COMMITTED" />
<xsd:enumeration value="REPEATABLE_READ" />
<xsd:enumeration value="SERIALIZABLE" />
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="pseudoTransactionalType">
<xsd:attributeGroup ref="transactionSyncAttributeGroup" />
</xsd:complexType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd"
xmlns:util="http://www.springframework.org/schema/util">
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

<context:property-placeholder properties-ref="props"/>

<util:properties id="props">
<beans:prop key="failover">false</beans:prop>
</util:properties>

<channel id="noLoadBalancerNoFailover" >
<dispatcher load-balancer="none" failover="false"/>
<dispatcher load-balancer="none" failover="${failover}"/>
</channel>
<channel id="noLoadBalancerNoFailoverExecutor" >
<dispatcher load-balancer="none" failover="false" task-executor="taskExecutor"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd">
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

<context:property-placeholder properties-ref="props"/>

<util:properties id="props">
<beans:prop key="majority">MAJORITY</beans:prop>
</util:properties>

<selector-chain id="selectorChain">
<selector ref="selector1"/>
<selector ref="selector2"/>
</selector-chain>

<selector-chain id="nestedSelectorChain" voting-strategy="MAJORITY">
<selector-chain id="nestedSelectorChain" voting-strategy="${majority}">
<selector ref="selector1"/>
<selector-chain voting-strategy="ALL">
<selector ref="selector2"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd">
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

<poller id="poller" receive-timeout="1234" fixed-rate="5" time-unit="SECONDS"/>
<context:property-placeholder properties-ref="props"/>

<util:properties id="props">
<beans:prop key="seconds">SECONDS</beans:prop>
</util:properties>

<poller id="poller" receive-timeout="1234" fixed-rate="5" time-unit="${seconds}"/>

</beans:beans>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd">
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

<context:property-placeholder properties-ref="props"/>

<util:properties id="props">
<beans:prop key="required">REQUIRED</beans:prop>
<beans:prop key="readCommitted">READ_COMMITTED</beans:prop>
</util:properties>

<channel id="input">
<queue capacity="1"/>
Expand All @@ -21,7 +30,7 @@
method="good"
output-channel="output">
<poller max-messages-per-poll="1" fixed-delay="10000">
<transactional transaction-manager="txManager" propagation="REQUIRED"/>
<transactional transaction-manager="txManager" propagation="${required}" isolation="${readCommitted}"/>
</poller>
</service-activator>

Expand Down
Loading

0 comments on commit aeeb9db

Please sign in to comment.