This commit is contained in:
Mark Fisher
2008-11-24 23:23:50 +00:00
parent 6b259faa14
commit 3717556f19
11 changed files with 34 additions and 25 deletions

View File

@@ -91,18 +91,19 @@ public class JmsMessageDrivenEndpointParser extends AbstractSingleBeanDefinition
}
// otherwise, we build a DefaultMessageListenerContainer instance
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(DefaultMessageListenerContainer.class);
String destination = element.getAttribute(JmsAdapterParserUtils.DESTINATION_ATTRIBUTE);
String destinationName = element.getAttribute(JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE);
String destinationAttribute = this.expectReply ? "request-destination" : "destination";
String destinationNameAttribute = this.expectReply ? "request-destination-name" : "destination-name";
String destination = element.getAttribute(destinationAttribute);
String destinationName = element.getAttribute(destinationNameAttribute);
Assert.isTrue(StringUtils.hasText(destination) ^ StringUtils.hasText(destinationName),
"Exactly one of '" + JmsAdapterParserUtils.DESTINATION_ATTRIBUTE +
"' or '" + JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE + "' is required.");
"Exactly one of '" + destinationAttribute + "' or '" + destinationNameAttribute + "' is required.");
builder.addPropertyReference(JmsAdapterParserUtils.CONNECTION_FACTORY_PROPERTY,
JmsAdapterParserUtils.determineConnectionFactoryBeanName(element));
if (StringUtils.hasText(destination)) {
builder.addPropertyReference(JmsAdapterParserUtils.DESTINATION_PROPERTY, destination);
builder.addPropertyReference("destination", destination);
}
else {
builder.addPropertyValue(JmsAdapterParserUtils.DESTINATION_NAME_PROPERTY, destinationName);
builder.addPropertyValue("destinationName", destinationName);
}
Integer acknowledgeMode = JmsAdapterParserUtils.parseAcknowledgeMode(element);
if (acknowledgeMode != null) {

View File

@@ -27,6 +27,8 @@
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="jmsInboundAdapterType">
<xsd:attribute name="destination" type="xsd:string"/>
<xsd:attribute name="destination-name" type="xsd:string"/>
<xsd:attribute name="channel" type="xsd:string"/>
<xsd:attribute name="message-converter" type="xsd:string"/>
<xsd:attribute name="header-mapper" type="xsd:string"/>
@@ -55,6 +57,8 @@
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="destination" type="xsd:string"/>
<xsd:attribute name="destination-name" type="xsd:string"/>
<xsd:attribute name="channel" type="xsd:string"/>
<xsd:attribute name="header-mapper" type="xsd:string"/>
<xsd:attribute name="extract-payload" type="xsd:string" default="true"/>
@@ -73,6 +77,8 @@
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="jmsInboundAdapterType">
<xsd:attribute name="request-destination" type="xsd:string"/>
<xsd:attribute name="request-destination-name" type="xsd:string"/>
<xsd:attribute name="message-converter" type="xsd:string"/>
<xsd:attribute name="header-mapper" type="xsd:string"/>
<xsd:attribute name="extract-request-payload" type="xsd:string" default="true"/>
@@ -136,6 +142,8 @@
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="destination" type="xsd:string"/>
<xsd:attribute name="destination-name" type="xsd:string"/>
<xsd:attribute name="channel" type="xsd:string"/>
<xsd:attribute name="header-mapper" type="xsd:string"/>
<xsd:attribute name="extract-payload" type="xsd:string" default="true"/>
@@ -199,8 +207,6 @@
</xsd:annotation>
<xsd:attribute name="id" type="xsd:ID"/>
<xsd:attribute name="connection-factory" type="xsd:string"/>
<xsd:attribute name="destination" type="xsd:string"/>
<xsd:attribute name="destination-name" type="xsd:string"/>
<xsd:attribute name="destination-resolver" type="xsd:string"/>
<xsd:attribute name="pub-sub-domain" type="xsd:string"/>
</xsd:complexType>

View File

@@ -16,12 +16,12 @@
<jms:inbound-gateway id="gatewayWithoutTransactionManager"
connection-factory="testConnectionFactory"
destination="testDestination"
request-destination="testDestination"
request-channel="requestChannel"/>
<jms:inbound-gateway id="gatewayWithTransactionManager"
connection-factory="testConnectionFactory"
destination="testDestination"
request-destination="testDestination"
request-channel="requestChannel"
transaction-manager="txManager"/>

View File

@@ -16,7 +16,7 @@
<jms:inbound-gateway id="jmsGateway"
connection-factory="testConnectionFactory"
destination="testDestination"
request-destination="testDestination"
request-channel="requestChannel"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">

View File

@@ -16,7 +16,7 @@
<jms:inbound-gateway id="jmsGateway"
connection-factory="testConnectionFactory"
destination-name="testDestinationName"
request-destination-name="testDestinationName"
request-channel="requestChannel"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">

View File

@@ -17,25 +17,25 @@
<jms:inbound-gateway id="gatewayWithConcurrentConsumers"
connection-factory="testConnectionFactory"
request-channel="requestChannel"
destination-name="test"
request-destination-name="test"
concurrent-consumers="3"/>
<jms:inbound-gateway id="gatewayWithMaxConcurrentConsumers"
connection-factory="testConnectionFactory"
request-channel="requestChannel"
destination-name="test"
request-destination-name="test"
max-concurrent-consumers="22"/>
<jms:inbound-gateway id="gatewayWithMaxMessagesPerTask"
connection-factory="testConnectionFactory"
request-channel="requestChannel"
destination-name="test"
request-destination-name="test"
max-messages-per-task="99"/>
<jms:inbound-gateway id="gatewayWithIdleTaskExecutionLimit"
connection-factory="testConnectionFactory"
request-channel="requestChannel"
destination-name="test"
request-destination-name="test"
idle-task-execution-limit="7"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">

View File

@@ -15,7 +15,7 @@
</si:channel>
<jms:inbound-gateway id="jmsGateway"
destination-name="testDestinationName"
request-destination-name="testDestinationName"
request-channel="requestChannel"/>
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">

View File

@@ -16,7 +16,7 @@
<jms:inbound-gateway id="jmsGateway"
connection-factory=""
destination-name="testDestinationName"
request-destination-name="testDestinationName"
request-channel="requestChannel"/>
</beans>

View File

@@ -16,7 +16,7 @@
<jms:inbound-gateway id="jmsGateway"
connection-factory="testConnectionFactory"
destination="testDestination"
request-destination="testDestination"
message-converter="converter"
request-channel="requestChannel"/>

View File

@@ -15,27 +15,27 @@
</si:channel>
<jms:inbound-gateway id="defaultGateway"
destination="testDestination"
request-destination="testDestination"
request-channel="requestChannel"/>
<jms:inbound-gateway id="extractReplyPayloadTrue"
destination="testDestination"
request-destination="testDestination"
request-channel="requestChannel"
extract-reply-payload="true"/>
<jms:inbound-gateway id="extractReplyPayloadFalse"
destination="testDestination"
request-destination="testDestination"
request-channel="requestChannel"
extract-reply-payload="false"/>
<jms:inbound-gateway id="extractRequestPayloadTrue"
destination="testDestination"
request-destination="testDestination"
request-channel="requestChannel"
extract-request-payload="true"/>
<jms:inbound-gateway id="extractRequestPayloadFalse"
destination="testDestination"
request-destination="testDestination"
request-channel="requestChannel"
extract-request-payload="false"/>