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/19 12:39:49 UTC

[camel] 01/02: CAMEL-12669 - Camel-Nats: add new client options available with client 2.x - noEcho 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

commit ab9b7f29ec1b69300db0f697aac89f59ab59888d
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Jul 19 14:37:23 2018 +0200

    CAMEL-12669 - Camel-Nats: add new client options available with client 2.x - noEcho option
---
 .../camel-nats/src/main/docs/nats-component.adoc       |  3 ++-
 .../apache/camel/component/nats/NatsConfiguration.java | 18 ++++++++++++++++++
 .../camel/component/nats/NatsConsumerLoadTest.java     |  2 +-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/components/camel-nats/src/main/docs/nats-component.adoc b/components/camel-nats/src/main/docs/nats-component.adoc
index d356918..74516c7 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 (20 parameters):
+==== Query Parameters (21 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -75,6 +75,7 @@ with the following path and query parameters:
 | *flushConnection* (common) | Define if we want to flush connection or not | false | boolean
 | *flushTimeout* (common) | Set the flush timeout | 1000 | int
 | *maxReconnectAttempts* (common) | Max reconnection attempts | 3 | int
+| *noEcho* (common) | Turn off echo. If supported by the gnatsd version you are connecting to this flag will prevent the server from echoing messages back to the connection if it has subscriptions on the subject being published to. | false | boolean
 | *noRandomizeServers* (common) | Whether or not randomizing the order of servers for the connection attempts | false | boolean
 | *pedantic* (common) | Whether or not running in pedantic mode (this affects performace) | false | boolean
 | *pingInterval* (common) | Ping interval to be aware if connection is still alive (in milliseconds) | 4000 | int
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 4f1eb53..4f9bd14 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 String replySubject;
     @UriParam
     private boolean noRandomizeServers;
+    @UriParam
+    private boolean noEcho;
     @UriParam(label = "consumer")
     private String queueName;
     @UriParam(label = "consumer")
@@ -179,6 +181,19 @@ public class NatsConfiguration {
     public void setNoRandomizeServers(boolean noRandomizeServers) {
         this.noRandomizeServers = noRandomizeServers;
     }
+    
+    /**
+     * Turn off echo. If supported by the gnatsd version you are connecting 
+     * to this flag will prevent the server from echoing messages back 
+     * to the connection if it has subscriptions on the subject being published to.
+     */
+    public boolean getNoEcho() {
+        return noEcho;
+    }
+
+    public void setNoEcho(boolean noEcho) {
+        this.noEcho = noEcho;
+    }
 
     /**
      * The Queue name if we are using nats for a queue configuration
@@ -280,6 +295,9 @@ public class NatsConfiguration {
         if (getNoRandomizeServers()) {
             builder.noRandomize();
         }
+        if (getNoEcho()) {
+            builder.noEcho();
+        }
         return builder;
     }
 
diff --git a/components/camel-nats/src/test/java/org/apache/camel/component/nats/NatsConsumerLoadTest.java b/components/camel-nats/src/test/java/org/apache/camel/component/nats/NatsConsumerLoadTest.java
index 830e031..b2f6d5a 100644
--- a/components/camel-nats/src/test/java/org/apache/camel/component/nats/NatsConsumerLoadTest.java
+++ b/components/camel-nats/src/test/java/org/apache/camel/component/nats/NatsConsumerLoadTest.java
@@ -30,7 +30,7 @@ import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Ignore;
 import org.junit.Test;
 
-@Ignore("Require a running Nats server")
+//@Ignore("Require a running Nats server")
 public class NatsConsumerLoadTest extends CamelTestSupport {
     
     @EndpointInject(uri = "mock:result")