diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java index d0f9cfdf59..d1be29d3d7 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java @@ -20,6 +20,7 @@ import java.util.UUID; import javax.jms.Connection; import javax.jms.ConnectionFactory; +import javax.jms.DeliveryMode; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.MessageConsumer; @@ -93,6 +94,18 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler { private final Object initializationMonitor = new Object(); + /** + * Set whether message delivery should be persistent or non-persistent, + * specified as boolean value ("true" or "false"). This will set the delivery + * mode accordingly, to either "PERSISTENT" (1) or "NON_PERSISTENT" (2). + *
Default it "true" aka delivery mode "PERSISTENT".
+ * @see #setDeliveryMode(int)
+ * @see javax.jms.DeliveryMode#PERSISTENT
+ * @see javax.jms.DeliveryMode#NON_PERSISTENT
+ */
+ public void setDeliveryPersistent(boolean deliveryPersistent) {
+ this.deliveryMode = (deliveryPersistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
+ }
/**
* Set the JMS ConnectionFactory that this gateway should use.
diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsOutboundGatewayParser.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsOutboundGatewayParser.java
index c52101c27c..a4ce6d0d2e 100644
--- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsOutboundGatewayParser.java
+++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsOutboundGatewayParser.java
@@ -16,8 +16,6 @@
package org.springframework.integration.jms.config;
-import javax.jms.DeliveryMode;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Element;
@@ -87,13 +85,7 @@ public class JmsOutboundGatewayParser extends AbstractConsumerEndpointParser {
builder.addPropertyValue("deliveryMode", deliveryMode);
}
else if (StringUtils.hasText(deliveryPersistent)){
- boolean persistentValue = Boolean.parseBoolean(deliveryPersistent);
- if (persistentValue){
- builder.addPropertyValue("deliveryMode", DeliveryMode.PERSISTENT);
- }
- else {
- builder.addPropertyValue("deliveryMode", DeliveryMode.NON_PERSISTENT);
- }
+ builder.addPropertyValue("deliveryPersistent", deliveryPersistent);
}
return builder;
}
diff --git a/spring-integration-jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-2.0.xsd b/spring-integration-jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-2.0.xsd
index 260ecc8a40..d8f547644d 100644
--- a/spring-integration-jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-2.0.xsd
+++ b/spring-integration-jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-2.0.xsd
@@ -738,7 +738,7 @@
]]>
-