INT-932 added the following properties: reply-time-to-live, reply-priority, reply-delivery-persistent
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
@@ -37,6 +37,8 @@ public abstract class AbstractJmsTemplateBasedAdapter implements InitializingBea
|
||||
|
||||
private volatile String destinationName;
|
||||
|
||||
private volatile boolean pubSubDomain;
|
||||
|
||||
private volatile DestinationResolver destinationResolver;
|
||||
|
||||
private volatile JmsTemplate jmsTemplate;
|
||||
@@ -82,6 +84,10 @@ public abstract class AbstractJmsTemplateBasedAdapter implements InitializingBea
|
||||
this.destinationName = destinationName;
|
||||
}
|
||||
|
||||
public void setPubSubDomain(boolean pubSubDomain) {
|
||||
this.pubSubDomain = pubSubDomain;
|
||||
}
|
||||
|
||||
public void setDestinationResolver(DestinationResolver destinationResolver) {
|
||||
this.destinationResolver = destinationResolver;
|
||||
}
|
||||
@@ -126,6 +132,7 @@ public abstract class AbstractJmsTemplateBasedAdapter implements InitializingBea
|
||||
}
|
||||
else {
|
||||
jmsTemplate.setDefaultDestinationName(this.destinationName);
|
||||
jmsTemplate.setPubSubDomain(this.pubSubDomain);
|
||||
}
|
||||
if (this.destinationResolver != null) {
|
||||
jmsTemplate.setDestinationResolver(this.destinationResolver);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.integration.jms;
|
||||
|
||||
import javax.jms.DeliveryMode;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.InvalidDestinationException;
|
||||
import javax.jms.JMSException;
|
||||
@@ -55,6 +56,12 @@ public class ChannelPublishingJmsMessageListener implements SessionAwareMessageL
|
||||
|
||||
private volatile Object defaultReplyDestination;
|
||||
|
||||
private volatile long replyTimeToLive = javax.jms.Message.DEFAULT_TIME_TO_LIVE;
|
||||
|
||||
private volatile int replyPriority = javax.jms.Message.DEFAULT_PRIORITY;
|
||||
|
||||
private volatile int replyDeliveryMode = javax.jms.Message.DEFAULT_DELIVERY_MODE;
|
||||
|
||||
private volatile DestinationResolver destinationResolver = new DynamicDestinationResolver();
|
||||
|
||||
private volatile JmsHeaderMapper headerMapper;
|
||||
@@ -127,6 +134,30 @@ public class ChannelPublishingJmsMessageListener implements SessionAwareMessageL
|
||||
this.defaultReplyDestination = new DestinationNameHolder(destinationName, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the time-to-live property for JMS reply Messages.
|
||||
* @see javax.jms.MessageProducer#setTimeToLive(long)
|
||||
*/
|
||||
public void setReplyTimeToLive(long replyTimeToLive) {
|
||||
this.replyTimeToLive = replyTimeToLive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the priority value for JMS reply Messages.
|
||||
* @see javax.jms.MessageProducer#setPriority(int)
|
||||
*/
|
||||
public void setReplyPriority(int replyPriority) {
|
||||
this.replyPriority = replyPriority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the delivery mode for JMS reply Messages.
|
||||
* @see javax.jms.MessageProducer#setDeliveryMode(int)
|
||||
*/
|
||||
public void setReplyDeliveryPersistent(boolean replyDeliveryPersistent) {
|
||||
this.replyDeliveryMode = replyDeliveryPersistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the DestinationResolver that should be used to resolve reply
|
||||
* destination names for this listener.
|
||||
@@ -214,6 +245,9 @@ public class ChannelPublishingJmsMessageListener implements SessionAwareMessageL
|
||||
jmsReply.setJMSCorrelationID(jmsMessage.getJMSMessageID());
|
||||
}
|
||||
MessageProducer producer = session.createProducer(destination);
|
||||
producer.setTimeToLive(this.replyTimeToLive);
|
||||
producer.setPriority(this.replyPriority);
|
||||
producer.setDeliveryMode(this.replyDeliveryMode);
|
||||
try {
|
||||
producer.send(jmsReply);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
@@ -42,6 +42,10 @@ abstract class JmsAdapterParserUtils {
|
||||
|
||||
static final String DESTINATION_NAME_ATTRIBUTE = "destination-name";
|
||||
|
||||
static final String PUB_SUB_DOMAIN_ATTRIBUTE = "pub-sub-domain";
|
||||
|
||||
static final String PUB_SUB_DOMAIN_PROPERTY = "pubSubDomain";
|
||||
|
||||
static final String DESTINATION_NAME_PROPERTY = "destinationName";
|
||||
|
||||
static final String HEADER_MAPPER_ATTRIBUTE = "header-mapper";
|
||||
|
||||
@@ -45,36 +45,48 @@ public class JmsInboundChannelAdapterParser extends AbstractPollingInboundChanne
|
||||
|
||||
@Override
|
||||
protected String parseSource(Element element, ParserContext parserContext) {
|
||||
Object source = parserContext.extractSource(element);
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
"org.springframework.integration.jms.JmsDestinationPollingSource");
|
||||
String jmsTemplate = element.getAttribute(JmsAdapterParserUtils.JMS_TEMPLATE_ATTRIBUTE);
|
||||
String destination = element.getAttribute(JmsAdapterParserUtils.DESTINATION_ATTRIBUTE);
|
||||
String destinationName = element.getAttribute(JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE);
|
||||
String pubSubDomain = element.getAttribute(JmsAdapterParserUtils.PUB_SUB_DOMAIN_ATTRIBUTE);
|
||||
String headerMapper = element.getAttribute(JmsAdapterParserUtils.HEADER_MAPPER_ATTRIBUTE);
|
||||
boolean hasDestinationRef = StringUtils.hasText(destination);
|
||||
boolean hasDestinationName = StringUtils.hasText(destinationName);
|
||||
if (StringUtils.hasText(jmsTemplate)) {
|
||||
if (element.hasAttribute(JmsAdapterParserUtils.CONNECTION_FACTORY_ATTRIBUTE) ||
|
||||
element.hasAttribute(JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE) ||
|
||||
element.hasAttribute(JmsAdapterParserUtils.DESTINATION_ATTRIBUTE)) {
|
||||
throw new BeanCreationException(
|
||||
hasDestinationRef || hasDestinationName) {
|
||||
parserContext.getReaderContext().error(
|
||||
"When providing '" + JmsAdapterParserUtils.JMS_TEMPLATE_ATTRIBUTE +
|
||||
"', none of '" + JmsAdapterParserUtils.CONNECTION_FACTORY_ATTRIBUTE +
|
||||
"', '" + JmsAdapterParserUtils.DESTINATION_ATTRIBUTE + "', or '" +
|
||||
JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE + "' should be provided.");
|
||||
JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE + "' are allowed.",
|
||||
source);
|
||||
}
|
||||
builder.addConstructorArgReference(jmsTemplate);
|
||||
}
|
||||
else if (StringUtils.hasText(destination) || StringUtils.hasText(destinationName)) {
|
||||
else if (hasDestinationRef || hasDestinationName) {
|
||||
builder.addConstructorArgReference(JmsAdapterParserUtils.determineConnectionFactoryBeanName(element, parserContext));
|
||||
if (StringUtils.hasText(destination)) {
|
||||
if (hasDestinationRef) {
|
||||
if (hasDestinationName) {
|
||||
parserContext.getReaderContext().error("The 'destination-name' " +
|
||||
"and 'destination' attributes are mutually exclusive.", source);
|
||||
}
|
||||
builder.addConstructorArgReference(destination);
|
||||
}
|
||||
else if (StringUtils.hasText(destinationName)) {
|
||||
else if (hasDestinationName) {
|
||||
builder.addConstructorArgValue(destinationName);
|
||||
if (StringUtils.hasText(pubSubDomain)) {
|
||||
builder.addPropertyValue(JmsAdapterParserUtils.PUB_SUB_DOMAIN_PROPERTY, pubSubDomain);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new BeanCreationException("either a '" + JmsAdapterParserUtils.JMS_TEMPLATE_ATTRIBUTE + "' or one of '" +
|
||||
JmsAdapterParserUtils.DESTINATION_ATTRIBUTE + "' or '" + JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE +
|
||||
throw new BeanCreationException("either a '" + JmsAdapterParserUtils.JMS_TEMPLATE_ATTRIBUTE +
|
||||
"' or one of '" + JmsAdapterParserUtils.DESTINATION_ATTRIBUTE + "' or '"
|
||||
+ JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE +
|
||||
"' attributes must be provided for a polling JMS adapter");
|
||||
}
|
||||
if (StringUtils.hasText(headerMapper)) {
|
||||
|
||||
@@ -41,12 +41,18 @@ public class JmsMessageDrivenEndpointParser extends AbstractSingleBeanDefinition
|
||||
|
||||
private static final String DEFAULT_REPLY_TOPIC_NAME_ATTRIB = "default-reply-topic-name";
|
||||
|
||||
private static final String REPLY_TIME_TO_LIVE = "reply-time-to-live";
|
||||
|
||||
private static final String REPLY_PRIORITY = "reply-priority";
|
||||
|
||||
private static final String REPLY_DELIVERY_PERSISTENT = "reply-delivery-persistent";
|
||||
|
||||
|
||||
private static String[] containerAttributes = new String[] {
|
||||
JmsAdapterParserUtils.CONNECTION_FACTORY_PROPERTY,
|
||||
JmsAdapterParserUtils.DESTINATION_ATTRIBUTE,
|
||||
JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE,
|
||||
"destination-resolver", "transaction-manager", "pub-sub-domain",
|
||||
"destination-resolver", "transaction-manager",
|
||||
"concurrent-consumers", "max-concurrent-consumers",
|
||||
"max-messages-per-task", "idle-task-execution-limit", "selector"
|
||||
};
|
||||
@@ -101,17 +107,22 @@ public class JmsMessageDrivenEndpointParser extends AbstractSingleBeanDefinition
|
||||
String destinationNameAttribute = this.expectReply ? "request-destination-name" : "destination-name";
|
||||
String destination = element.getAttribute(destinationAttribute);
|
||||
String destinationName = element.getAttribute(destinationNameAttribute);
|
||||
if (!(StringUtils.hasText(destination) ^ StringUtils.hasText(destinationName))) {
|
||||
boolean hasDestination = StringUtils.hasText(destination);
|
||||
boolean hasDestinationName = StringUtils.hasText(destinationName);
|
||||
if (!(hasDestination ^ hasDestinationName)) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Exactly one of '" + destinationAttribute + "' or '" + destinationNameAttribute + "' is required.", element);
|
||||
"Exactly one of '" + destinationAttribute +
|
||||
"' or '" + destinationNameAttribute + "' is required.", element);
|
||||
}
|
||||
builder.addPropertyReference(JmsAdapterParserUtils.CONNECTION_FACTORY_PROPERTY,
|
||||
JmsAdapterParserUtils.determineConnectionFactoryBeanName(element, parserContext));
|
||||
if (StringUtils.hasText(destination)) {
|
||||
if (hasDestination) {
|
||||
builder.addPropertyReference("destination", destination);
|
||||
}
|
||||
else {
|
||||
builder.addPropertyValue("destinationName", destinationName);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element,
|
||||
"request-pub-sub-domain", "pubSubDomain");
|
||||
}
|
||||
Integer acknowledgeMode = JmsAdapterParserUtils.parseAcknowledgeMode(element, parserContext);
|
||||
if (acknowledgeMode != null) {
|
||||
@@ -124,7 +135,6 @@ public class JmsMessageDrivenEndpointParser extends AbstractSingleBeanDefinition
|
||||
}
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "destination-resolver");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "transaction-manager");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "pub-sub-domain");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "selector", "messageSelector");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "concurrent-consumers");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "max-concurrent-consumers");
|
||||
@@ -163,6 +173,9 @@ public class JmsMessageDrivenEndpointParser extends AbstractSingleBeanDefinition
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, DEFAULT_REPLY_QUEUE_NAME_ATTRIB);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, DEFAULT_REPLY_TOPIC_NAME_ATTRIB);
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "destination-resolver");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, REPLY_TIME_TO_LIVE);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, REPLY_PRIORITY);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, REPLY_DELIVERY_PERSISTENT);
|
||||
}
|
||||
else {
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "channel", "requestChannel");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
@@ -27,7 +27,7 @@ import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Parser for the <jms-target/> element.
|
||||
* Parser for the <outbound-channel-adapter/> element of the jms namespace.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@@ -41,16 +41,17 @@ public class JmsOutboundChannelAdapterParser extends AbstractOutboundChannelAdap
|
||||
String destination = element.getAttribute(JmsAdapterParserUtils.DESTINATION_ATTRIBUTE);
|
||||
String destinationName = element.getAttribute(JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE);
|
||||
String headerMapper = element.getAttribute(JmsAdapterParserUtils.HEADER_MAPPER_ATTRIBUTE);
|
||||
boolean hasDestinationRef = StringUtils.hasText(destination);
|
||||
boolean hasDestinationName = StringUtils.hasText(destinationName);
|
||||
if (StringUtils.hasText(jmsTemplate)) {
|
||||
if (element.hasAttribute(JmsAdapterParserUtils.CONNECTION_FACTORY_ATTRIBUTE) ||
|
||||
element.hasAttribute(JmsAdapterParserUtils.DESTINATION_ATTRIBUTE) ||
|
||||
element.hasAttribute(JmsAdapterParserUtils.DESTINATION_NAME_ATTRIBUTE)) {
|
||||
hasDestinationRef || hasDestinationName) {
|
||||
throw new BeanCreationException("When providing a 'jms-template' reference, none of " +
|
||||
"'connection-factory', 'destination', or 'destination-name' should be provided.");
|
||||
}
|
||||
builder.addPropertyReference(JmsAdapterParserUtils.JMS_TEMPLATE_PROPERTY, jmsTemplate);
|
||||
}
|
||||
else if (StringUtils.hasText(destination) ^ StringUtils.hasText(destinationName)) {
|
||||
else if (hasDestinationRef ^ hasDestinationName) {
|
||||
builder.addPropertyReference(JmsAdapterParserUtils.CONNECTION_FACTORY_PROPERTY,
|
||||
JmsAdapterParserUtils.determineConnectionFactoryBeanName(element, parserContext));
|
||||
if (StringUtils.hasText(destination)) {
|
||||
@@ -58,6 +59,8 @@ public class JmsOutboundChannelAdapterParser extends AbstractOutboundChannelAdap
|
||||
}
|
||||
else {
|
||||
builder.addPropertyValue(JmsAdapterParserUtils.DESTINATION_NAME_PROPERTY, destinationName);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(
|
||||
builder, element, JmsAdapterParserUtils.PUB_SUB_DOMAIN_ATTRIBUTE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -330,6 +330,11 @@
|
||||
<xsd:extension base="jmsMessageDrivenInboundAdapterType">
|
||||
<xsd:attribute name="destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A reference to a javax.jms.Destination by bean name. As an alternative to a bean
|
||||
reference, use 'destination-name' and 'pub-sub-domain' which will rely upon the
|
||||
DestinationResolver strategy (DynamicDestinationResolver by default).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
@@ -338,6 +343,7 @@
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="destination-name" type="xsd:string"/>
|
||||
<xsd:attribute name="pub-sub-domain" type="xsd:string"/>
|
||||
<xsd:attribute name="channel" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
@@ -390,6 +396,11 @@
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A reference to a javax.jms.Destination by bean name. As an alternative to a bean
|
||||
reference, use 'destination-name' and 'pub-sub-domain' which will rely upon the
|
||||
DestinationResolver strategy (DynamicDestinationResolver by default).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
@@ -398,6 +409,7 @@
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="destination-name" type="xsd:string"/>
|
||||
<xsd:attribute name="pub-sub-domain" type="xsd:string"/>
|
||||
<xsd:attribute name="channel" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
@@ -442,6 +454,11 @@
|
||||
<xsd:extension base="jmsMessageDrivenInboundAdapterType">
|
||||
<xsd:attribute name="request-destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A reference to a javax.jms.Destination by bean name. As an alternative to a bean
|
||||
reference, use 'request-destination-name' and 'request-pub-sub-domain' which will rely
|
||||
upon the DestinationResolver strategy (DynamicDestinationResolver by default).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
@@ -450,8 +467,14 @@
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="request-destination-name" type="xsd:string"/>
|
||||
<xsd:attribute name="request-pub-sub-domain" type="xsd:string"/>
|
||||
<xsd:attribute name="default-reply-destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A reference to a javax.jms.Destination by bean name. As an alternative to a bean
|
||||
reference, use either 'default-reply-queue-name' or 'default-reply-topic-name' which
|
||||
will rely upon the DestinationResolver strategy (DynamicDestinationResolver by default).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
@@ -496,6 +519,9 @@
|
||||
<xsd:attribute name="max-concurrent-consumers" type="xsd:string"/>
|
||||
<xsd:attribute name="max-messages-per-task" type="xsd:string"/>
|
||||
<xsd:attribute name="idle-task-execution-limit" type="xsd:string"/>
|
||||
<xsd:attribute name="reply-time-to-live" type="xsd:string"/>
|
||||
<xsd:attribute name="reply-priority" type="xsd:string"/>
|
||||
<xsd:attribute name="reply-delivery-persistent" type="xsd:string"/>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
@@ -534,6 +560,11 @@
|
||||
<xsd:attribute name="reply-timeout" type="xsd:string"/>
|
||||
<xsd:attribute name="request-destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A reference to a javax.jms.Destination by bean name. As an alternative to a bean
|
||||
reference, use 'request-destination-name' and 'request-pub-sub-domain' which will rely
|
||||
upon the DestinationResolver strategy (DynamicDestinationResolver by default).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
@@ -542,8 +573,14 @@
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="request-destination-name" type="xsd:string"/>
|
||||
<xsd:attribute name="request-pub-sub-domain" type="xsd:string"/>
|
||||
<xsd:attribute name="reply-destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A reference to a javax.jms.Destination by bean name. As an alternative to a bean
|
||||
reference, use 'reply-destination-name' and 'reply-pub-sub-domain' which will rely
|
||||
upon the DestinationResolver strategy (DynamicDestinationResolver by default).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
@@ -552,6 +589,7 @@
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="reply-destination-name" type="xsd:string"/>
|
||||
<xsd:attribute name="reply-pub-sub-domain" type="xsd:string"/>
|
||||
<xsd:attribute name="destination-resolver" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
@@ -561,7 +599,6 @@
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="pub-sub-domain" type="xsd:string"/>
|
||||
<xsd:attribute name="connection-factory" type="xsd:string" default="connectionFactory">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
@@ -621,6 +658,11 @@
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A reference to a javax.jms.Destination by bean name. As an alternative to a bean
|
||||
reference, use 'destination-name' and 'pub-sub-domain' which will rely upon the
|
||||
DestinationResolver strategy (DynamicDestinationResolver by default).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
@@ -629,6 +671,7 @@
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="destination-name" type="xsd:string"/>
|
||||
<xsd:attribute name="pub-sub-domain" type="xsd:string"/>
|
||||
<xsd:attribute name="channel" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
@@ -807,7 +850,6 @@
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="pub-sub-domain" type="xsd:string"/>
|
||||
<xsd:attribute name="auto-startup" type="xsd:string" default="true"/>
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
@@ -21,6 +21,8 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import javax.jms.DeliveryMode;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
@@ -262,4 +264,16 @@ public class JmsInboundGatewayParserTests {
|
||||
gateway.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGatewayWithReplyQosProperties() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"inboundGatewayWithReplyQos.xml", this.getClass());
|
||||
JmsMessageDrivenEndpoint gateway = context.getBean("gatewayWithReplyQos", JmsMessageDrivenEndpoint.class);
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(
|
||||
new DirectFieldAccessor(gateway).getPropertyValue("listener"));
|
||||
assertEquals(12345L, accessor.getPropertyValue("replyTimeToLive"));
|
||||
assertEquals(7, accessor.getPropertyValue("replyPriority"));
|
||||
assertEquals(DeliveryMode.NON_PERSISTENT, accessor.getPropertyValue("replyDeliveryMode"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:jms="http://www.springframework.org/schema/integration/jms"
|
||||
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
|
||||
http://www.springframework.org/schema/integration/jms
|
||||
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
<si:channel id="requestChannel">
|
||||
<si:queue/>
|
||||
</si:channel>
|
||||
|
||||
<jms:inbound-gateway id="gatewayWithReplyQos"
|
||||
request-destination-name="testDestinationName"
|
||||
request-channel="requestChannel"
|
||||
reply-time-to-live="12345"
|
||||
reply-priority="7"
|
||||
reply-delivery-persistent="false"/>
|
||||
|
||||
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
|
||||
<constructor-arg>
|
||||
<bean class="org.springframework.integration.jms.StubConnection">
|
||||
<constructor-arg value="test"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -17,25 +17,29 @@
|
||||
<jms:inbound-gateway id="gatewayWithConcurrentConsumers"
|
||||
connection-factory="testConnectionFactory"
|
||||
request-channel="requestChannel"
|
||||
request-destination-name="test"
|
||||
request-destination-name="testQueue"
|
||||
request-pub-sub-domain="false"
|
||||
concurrent-consumers="3"/>
|
||||
|
||||
<jms:inbound-gateway id="gatewayWithMaxConcurrentConsumers"
|
||||
connection-factory="testConnectionFactory"
|
||||
request-channel="requestChannel"
|
||||
request-destination-name="test"
|
||||
request-destination-name="testTopic"
|
||||
request-pub-sub-domain="true"
|
||||
max-concurrent-consumers="22"/>
|
||||
|
||||
<jms:inbound-gateway id="gatewayWithMaxMessagesPerTask"
|
||||
connection-factory="testConnectionFactory"
|
||||
request-channel="requestChannel"
|
||||
request-destination-name="test"
|
||||
request-destination-name="testQueue"
|
||||
request-pub-sub-domain="false"
|
||||
max-messages-per-task="99"/>
|
||||
|
||||
<jms:inbound-gateway id="gatewayWithIdleTaskExecutionLimit"
|
||||
connection-factory="testConnectionFactory"
|
||||
request-channel="requestChannel"
|
||||
request-destination-name="test"
|
||||
request-destination-name="testTopic"
|
||||
request-pub-sub-domain="true"
|
||||
idle-task-execution-limit="7"/>
|
||||
|
||||
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
|
||||
|
||||
Reference in New Issue
Block a user