You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/07/20 13:31:21 UTC

[camel] branch master updated: CAMEL-12669 - Camel-Nats: add new client options available with client 2.x - requestCleanupInterval option

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8d50501  CAMEL-12669 - Camel-Nats: add new client options available with client 2.x - requestCleanupInterval option
8d50501 is described below

commit 8d505012faf27c4cde98df61e67a7590e129526a
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Jul 20 15:30:48 2018 +0200

    CAMEL-12669 - Camel-Nats: add new client options available with client 2.x - requestCleanupInterval option
---
 components/camel-nats/src/main/docs/nats-component.adoc    |  3 ++-
 .../org/apache/camel/component/nats/NatsConfiguration.java | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/components/camel-nats/src/main/docs/nats-component.adoc b/components/camel-nats/src/main/docs/nats-component.adoc
index 337ee7a..2f19c59 100644
--- a/components/camel-nats/src/main/docs/nats-component.adoc
+++ b/components/camel-nats/src/main/docs/nats-component.adoc
@@ -66,7 +66,7 @@ with the following path and query parameters:
 |===
 
 
-==== Query Parameters (23 parameters):
+==== Query Parameters (24 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -83,6 +83,7 @@ with the following path and query parameters:
 | *pingInterval* (common) | Ping interval to be aware if connection is still alive (in milliseconds) | 120000 | int
 | *reconnect* (common) | Whether or not using reconnection feature | true | boolean
 | *reconnectTimeWait* (common) | Waiting time before attempts reconnection (in milliseconds) | 2000 | int
+| *requestCleanupInterval* (common) | Interval to clean up cancelled/timed out requests. | 5000 | int
 | *topic* (common) | *Required* The name of topic we want to use |  | String
 | *verbose* (common) | Whether or not running in verbose mode | false | boolean
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
diff --git a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java
index 02b9dfd..4ecc74095 100644
--- a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java
+++ b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java
@@ -53,6 +53,8 @@ public class NatsConfiguration {
     private int connectionTimeout = 2000;
     @UriParam(label = "common", defaultValue = "2")
     private int maxPingsOut = Options.DEFAULT_MAX_PINGS_OUT;
+    @UriParam(label = "common", defaultValue = "5000")
+    private int requestCleanupInterval = 5000;
     @UriParam(label = "producer")
     private String replySubject;
     @UriParam
@@ -165,6 +167,17 @@ public class NatsConfiguration {
     }
 
     /**
+     *  Interval to clean up cancelled/timed out requests.
+     */
+    public int getRequestCleanupInterval() {
+        return requestCleanupInterval;
+    }
+
+    public void setRequestCleanupInterval(int requestCleanupInterval) {
+        this.requestCleanupInterval = requestCleanupInterval;
+    }
+
+    /**
      * Ping interval to be aware if connection is still alive (in milliseconds)
      */
     public int getPingInterval() {
@@ -321,6 +334,7 @@ public class NatsConfiguration {
         builder.pingInterval(Duration.ofMillis(getPingInterval()));
         builder.connectionTimeout(Duration.ofMillis(getConnectionTimeout()));
         builder.maxPingsOut(getMaxPingsOut());
+        builder.requestCleanupInterval(Duration.ofMillis(getRequestCleanupInterval()));
         if (getNoRandomizeServers()) {
             builder.noRandomize();
         }