This is an automated email from the ASF dual-hosted git repository.

janbednar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit ab08e6e4c82aada0546f5a24bcfa1bc0c9b7137e
Author: mahdikarami77 <mahdikaram...@ut.ac.ir>
AuthorDate: Thu Aug 1 23:49:17 2019 +0430

    CAMEL-13786: add delivery delay to jms component
---
 .../src/main/docs/activemq-component.adoc          |  3 +-
 .../camel-amqp/src/main/docs/amqp-component.adoc   |  3 +-
 .../camel-jms/src/main/docs/jms-component.adoc     |  3 +-
 .../camel/component/jms/JmsConfiguration.java      | 32 +++++++++++++++++-----
 .../endpoint/dsl/AMQPEndpointBuilderFactory.java   | 22 +++++++++++++++
 .../dsl/ActiveMQEndpointBuilderFactory.java        | 23 ++++++++++++++++
 .../endpoint/dsl/JmsEndpointBuilderFactory.java    | 22 +++++++++++++++
 .../jms/springboot/JmsComponentConfiguration.java  | 12 ++++++++
 8 files changed, 110 insertions(+), 10 deletions(-)

diff --git a/components/camel-activemq/src/main/docs/activemq-component.adoc 
b/components/camel-activemq/src/main/docs/activemq-component.adoc
index 9fd81ea..b251fd6 100644
--- a/components/camel-activemq/src/main/docs/activemq-component.adoc
+++ b/components/camel-activemq/src/main/docs/activemq-component.adoc
@@ -162,7 +162,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (92 parameters):
+=== Query Parameters (93 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -198,6 +198,7 @@ with the following path and query parameters:
 | *exposeListenerSession* (consumer) | Specifies whether the listener session 
should be exposed when consuming messages. | false | boolean
 | *replyToSameDestination Allowed* (consumer) | Whether a JMS consumer is 
allowed to send a reply message to the same destination that the consumer is 
using to consume from. This prevents an endless loop by consuming and sending 
back the same message to itself. | false | boolean
 | *taskExecutor* (consumer) | Allows you to specify a custom task executor for 
consuming messages. |  | TaskExecutor
+| *deliveryDelay* (producer) | Sets delivery delay to use for send calls for 
JMS. | -1 | long
 | *deliveryMode* (producer) | Specifies the delivery mode to be used. 
Possibles values are those defined by javax.jms.DeliveryMode. NON_PERSISTENT = 
1 and PERSISTENT = 2. |  | Integer
 | *deliveryPersistent* (producer) | Specifies whether persistent delivery is 
used by default. | true | boolean
 | *explicitQosEnabled* (producer) | Set if the deliveryMode, priority or 
timeToLive qualities of service should be used when sending messages. This 
option is based on Spring's JmsTemplate. The deliveryMode, priority and 
timeToLive options are applied to the current endpoint. This contrasts with the 
preserveMessageQos option, which operates at message granularity, reading QoS 
properties exclusively from the Camel In message headers. | false | Boolean
diff --git a/components/camel-amqp/src/main/docs/amqp-component.adoc 
b/components/camel-amqp/src/main/docs/amqp-component.adoc
index 5a973ef..6f00c4f 100644
--- a/components/camel-amqp/src/main/docs/amqp-component.adoc
+++ b/components/camel-amqp/src/main/docs/amqp-component.adoc
@@ -152,7 +152,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (92 parameters):
+=== Query Parameters (93 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -188,6 +188,7 @@ with the following path and query parameters:
 | *exposeListenerSession* (consumer) | Specifies whether the listener session 
should be exposed when consuming messages. | false | boolean
 | *replyToSameDestination Allowed* (consumer) | Whether a JMS consumer is 
allowed to send a reply message to the same destination that the consumer is 
using to consume from. This prevents an endless loop by consuming and sending 
back the same message to itself. | false | boolean
 | *taskExecutor* (consumer) | Allows you to specify a custom task executor for 
consuming messages. |  | TaskExecutor
+| *deliveryDelay* (producer) | Sets delivery delay to use for send calls for 
JMS. | -1 | long
 | *deliveryMode* (producer) | Specifies the delivery mode to be used. 
Possibles values are those defined by javax.jms.DeliveryMode. NON_PERSISTENT = 
1 and PERSISTENT = 2. |  | Integer
 | *deliveryPersistent* (producer) | Specifies whether persistent delivery is 
used by default. | true | boolean
 | *explicitQosEnabled* (producer) | Set if the deliveryMode, priority or 
timeToLive qualities of service should be used when sending messages. This 
option is based on Spring's JmsTemplate. The deliveryMode, priority and 
timeToLive options are applied to the current endpoint. This contrasts with the 
preserveMessageQos option, which operates at message granularity, reading QoS 
properties exclusively from the Camel In message headers. | false | Boolean
diff --git a/components/camel-jms/src/main/docs/jms-component.adoc 
b/components/camel-jms/src/main/docs/jms-component.adoc
index 7be325d..405d99f 100644
--- a/components/camel-jms/src/main/docs/jms-component.adoc
+++ b/components/camel-jms/src/main/docs/jms-component.adoc
@@ -319,7 +319,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (92 parameters):
+=== Query Parameters (93 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -355,6 +355,7 @@ with the following path and query parameters:
 | *exposeListenerSession* (consumer) | Specifies whether the listener session 
should be exposed when consuming messages. | false | boolean
 | *replyToSameDestination Allowed* (consumer) | Whether a JMS consumer is 
allowed to send a reply message to the same destination that the consumer is 
using to consume from. This prevents an endless loop by consuming and sending 
back the same message to itself. | false | boolean
 | *taskExecutor* (consumer) | Allows you to specify a custom task executor for 
consuming messages. |  | TaskExecutor
+| *deliveryDelay* (producer) | Sets delivery delay to use for send calls for 
JMS. | -1 | long
 | *deliveryMode* (producer) | Specifies the delivery mode to be used. 
Possibles values are those defined by javax.jms.DeliveryMode. NON_PERSISTENT = 
1 and PERSISTENT = 2. |  | Integer
 | *deliveryPersistent* (producer) | Specifies whether persistent delivery is 
used by default. | true | boolean
 | *explicitQosEnabled* (producer) | Set if the deliveryMode, priority or 
timeToLive qualities of service should be used when sending messages. This 
option is based on Spring's JmsTemplate. The deliveryMode, priority and 
timeToLive options are applied to the current endpoint. This contrasts with the 
preserveMessageQos option, which operates at message granularity, reading QoS 
properties exclusively from the Camel In message headers. | false | Boolean
diff --git 
a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
 
b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
index 47ec84c..37cc482 100644
--- 
a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
+++ 
b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
@@ -110,14 +110,14 @@ public class JmsConfiguration implements Cloneable {
                     + " the DefaultMessageListenerContainer.runningAllowed 
flag to quick stop in case JmsConfiguration#isAcceptMessagesWhileStopping"
                     + " is enabled, and org.apache.camel.CamelContext is 
currently being stopped. This quick stop ability is enabled by"
                     + " default in the regular JMS consumers but to enable for 
reply managers you must enable this flag.")
-    private boolean allowReplyManagerQuickStop;   
+    private boolean allowReplyManagerQuickStop;
     @UriParam(label = "consumer,advanced",
             description = "Specifies whether the consumer accept messages 
while it is stopping."
                     + " You may consider enabling this option, if you start 
and stop JMS routes at runtime, while there are still messages"
                     + " enqueued on the queue. If this option is false, and 
you stop the JMS route, then messages may be rejected,"
                     + " and the JMS broker would have to attempt redeliveries, 
which yet again may be rejected, and eventually the message"
                     + " may be moved at a dead letter queue on the JMS broker. 
To avoid this its recommended to enable this option.")
-    private boolean acceptMessagesWhileStopping;    
+    private boolean acceptMessagesWhileStopping;
     @UriParam(description = "Sets the JMS client ID to use. Note that this 
value, if specified, must be unique and can only be used by a single JMS 
connection instance."
             + " It is typically only required for durable topic subscriptions."
             + " If using Apache ActiveMQ you may prefer to use Virtual Topics 
instead.")
@@ -232,7 +232,7 @@ public class JmsConfiguration implements Cloneable {
             description = "Specifies whether Camel should auto map the 
received JMS message to a suited payload type, such as javax.jms.TextMessage to 
a String etc.")
     private boolean mapJmsMessage = true;
     @UriParam(defaultValue = "true", label = "advanced",
-            description = "When sending, specifies whether message IDs should 
be added. This is just an hint to the JMS broker." 
+            description = "When sending, specifies whether message IDs should 
be added. This is just an hint to the JMS broker."
                     + " If the JMS provider accepts this hint, these messages 
must have the message ID set to null; if the provider ignores the hint, "
                     + "the message ID must be set to its normal unique value.")
     private boolean messageIdEnabled = true;
@@ -484,6 +484,10 @@ public class JmsConfiguration implements Cloneable {
     @UriParam(label = "producer", description = "Sets whether JMS date 
properties should be formatted according to the ISO 8601 standard.")
     private boolean formatDateHeadersToIso8601;
 
+    @UriParam(defaultValue = "-1", label = "producer", description = "Sets 
delivery delay to use for send calls for JMS. "
+         + "This option requires JMS 2.0 compliant broker.")
+    private long deliveryDelay = -1;
+
     public JmsConfiguration() {
     }
 
@@ -717,6 +721,9 @@ public class JmsConfiguration implements Cloneable {
                 
template.setSessionAcknowledgeModeName(acknowledgementModeName);
             }
         }
+
+        template.setDeliveryDelay(deliveryDelay);
+
         return template;
     }
 
@@ -863,7 +870,7 @@ public class JmsConfiguration implements Cloneable {
     }
 
     /**
-     * Whether the {@link DefaultMessageListenerContainer} used in the reply 
managers for request-reply messaging allow 
+     * Whether the {@link DefaultMessageListenerContainer} used in the reply 
managers for request-reply messaging allow
      * the {@link DefaultMessageListenerContainer#runningAllowed()} flag to 
quick stop in case {@link JmsConfiguration#isAcceptMessagesWhileStopping()}
      * is enabled, and {@link org.apache.camel.CamelContext} is currently 
being stopped. This quick stop ability is enabled by
      * default in the regular JMS consumers but to enable for reply managers 
you must enable this flag.
@@ -875,7 +882,7 @@ public class JmsConfiguration implements Cloneable {
     public void setAllowReplyManagerQuickStop(boolean 
allowReplyManagerQuickStop) {
         this.allowReplyManagerQuickStop = allowReplyManagerQuickStop;
     }
-    
+
     public String getClientId() {
         return clientId;
     }
@@ -1163,7 +1170,7 @@ public class JmsConfiguration implements Cloneable {
     public void 
setWaitForProvisionCorrelationToBeUpdatedThreadSleepingTime(long sleepingTime) {
         this.waitForProvisionCorrelationToBeUpdatedThreadSleepingTime = 
sleepingTime;
     }
-    
+
     public int getMaxConcurrentConsumers() {
         return maxConcurrentConsumers;
     }
@@ -2056,7 +2063,7 @@ public class JmsConfiguration implements Cloneable {
 
     /**
      * Use this JMS property to correlate messages in InOut exchange pattern 
(request-reply)
-     * instead of JMSCorrelationID property. This allows you to exchange 
messages with 
+     * instead of JMSCorrelationID property. This allows you to exchange 
messages with
      * systems that do not correlate messages using JMSCorrelationID JMS 
property. If used
      * JMSCorrelationID will not be used or set by Camel. The value of here 
named property
      * will be generated if not supplied in the header of the message under 
the same name.
@@ -2166,4 +2173,15 @@ public class JmsConfiguration implements Cloneable {
         this.formatDateHeadersToIso8601 = formatDateHeadersToIso8601;
     }
 
+    public long getDeliveryDelay() {
+        return deliveryDelay;
+    }
+
+    /**
+     * Sets delivery delay to use for send calls for JMS.
+     */
+    public void setDeliveryDelay(long deliveryDelay) {
+        this.deliveryDelay = deliveryDelay;
+    }
+
 }
diff --git 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/AMQPEndpointBuilderFactory.java
 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/AMQPEndpointBuilderFactory.java
index 4700246..a238d9e 100644
--- 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/AMQPEndpointBuilderFactory.java
+++ 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/AMQPEndpointBuilderFactory.java
@@ -2186,6 +2186,28 @@ public interface AMQPEndpointBuilderFactory {
             return this;
         }
         /**
+         * Sets delivery delay to use for send calls for JMS.
+         * 
+         * The option is a: <code>long</code> type.
+         * 
+         * Group: producer
+         */
+        default AMQPEndpointProducerBuilder deliveryDelay(long deliveryDelay) {
+            setProperty("deliveryDelay", deliveryDelay);
+            return this;
+        }
+        /**
+         * Sets delivery delay to use for send calls for JMS.
+         * 
+         * The option will be converted to a <code>long</code> type.
+         * 
+         * Group: producer
+         */
+        default AMQPEndpointProducerBuilder deliveryDelay(String 
deliveryDelay) {
+            setProperty("deliveryDelay", deliveryDelay);
+            return this;
+        }
+        /**
          * Specifies the delivery mode to be used. Possibles values are those
          * defined by javax.jms.DeliveryMode. NON_PERSISTENT = 1 and PERSISTENT
          * = 2.
diff --git 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ActiveMQEndpointBuilderFactory.java
 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ActiveMQEndpointBuilderFactory.java
index 5205408..ea56460 100644
--- 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ActiveMQEndpointBuilderFactory.java
+++ 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ActiveMQEndpointBuilderFactory.java
@@ -2194,6 +2194,29 @@ public interface ActiveMQEndpointBuilderFactory {
             return this;
         }
         /**
+         * Sets delivery delay to use for send calls for JMS.
+         * 
+         * The option is a: <code>long</code> type.
+         * 
+         * Group: producer
+         */
+        default ActiveMQEndpointProducerBuilder deliveryDelay(long 
deliveryDelay) {
+            setProperty("deliveryDelay", deliveryDelay);
+            return this;
+        }
+        /**
+         * Sets delivery delay to use for send calls for JMS.
+         * 
+         * The option will be converted to a <code>long</code> type.
+         * 
+         * Group: producer
+         */
+        default ActiveMQEndpointProducerBuilder deliveryDelay(
+                String deliveryDelay) {
+            setProperty("deliveryDelay", deliveryDelay);
+            return this;
+        }
+        /**
          * Specifies the delivery mode to be used. Possibles values are those
          * defined by javax.jms.DeliveryMode. NON_PERSISTENT = 1 and PERSISTENT
          * = 2.
diff --git 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/JmsEndpointBuilderFactory.java
 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/JmsEndpointBuilderFactory.java
index ffd9ad2..c6c4d58 100644
--- 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/JmsEndpointBuilderFactory.java
+++ 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/JmsEndpointBuilderFactory.java
@@ -2185,6 +2185,28 @@ public interface JmsEndpointBuilderFactory {
             return this;
         }
         /**
+         * Sets delivery delay to use for send calls for JMS.
+         * 
+         * The option is a: <code>long</code> type.
+         * 
+         * Group: producer
+         */
+        default JmsEndpointProducerBuilder deliveryDelay(long deliveryDelay) {
+            setProperty("deliveryDelay", deliveryDelay);
+            return this;
+        }
+        /**
+         * Sets delivery delay to use for send calls for JMS.
+         * 
+         * The option will be converted to a <code>long</code> type.
+         * 
+         * Group: producer
+         */
+        default JmsEndpointProducerBuilder deliveryDelay(String deliveryDelay) 
{
+            setProperty("deliveryDelay", deliveryDelay);
+            return this;
+        }
+        /**
          * Specifies the delivery mode to be used. Possibles values are those
          * defined by javax.jms.DeliveryMode. NON_PERSISTENT = 1 and PERSISTENT
          * = 2.
diff --git 
a/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
 
b/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
index 52c0d11..8df7569 100644
--- 
a/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
+++ 
b/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
@@ -1944,6 +1944,10 @@ public class JmsComponentConfiguration
          * 8601 standard.
          */
         private Boolean formatDateHeadersToIso8601 = false;
+        /**
+         * Sets delivery delay to use for send calls for JMS.
+         */
+        private Long deliveryDelay = -1L;
 
         public ConsumerType getConsumerType() {
             return consumerType;
@@ -2680,5 +2684,13 @@ public class JmsComponentConfiguration
                 Boolean formatDateHeadersToIso8601) {
             this.formatDateHeadersToIso8601 = formatDateHeadersToIso8601;
         }
+
+        public Long getDeliveryDelay() {
+            return deliveryDelay;
+        }
+
+        public void setDeliveryDelay(Long deliveryDelay) {
+            this.deliveryDelay = deliveryDelay;
+        }
     }
 }
\ No newline at end of file

Reply via email to