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 2016/01/19 15:13:18 UTC

[1/2] camel git commit: CAMEL-9267: camel-nats, unsubscribe from topic before stopping consumer

Repository: camel
Updated Branches:
  refs/heads/master 31d91911a -> ed4d1fa89


CAMEL-9267: camel-nats, unsubscribe from topic before stopping consumer


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/939a8951
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/939a8951
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/939a8951

Branch: refs/heads/master
Commit: 939a89514ceaeee8633523a70c03ae02fc4c4d45
Parents: 31d9191
Author: Andrea Cosentino <an...@gmail.com>
Authored: Tue Jan 19 15:10:58 2016 +0100
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Tue Jan 19 15:10:58 2016 +0100

----------------------------------------------------------------------
 components/camel-nats/pom.xml                               | 5 -----
 .../java/org/apache/camel/component/nats/NatsConsumer.java  | 9 ++++++++-
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/939a8951/components/camel-nats/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-nats/pom.xml b/components/camel-nats/pom.xml
index f6130a9..e0da0c8 100644
--- a/components/camel-nats/pom.xml
+++ b/components/camel-nats/pom.xml
@@ -55,11 +55,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/camel/blob/939a8951/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConsumer.java b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConsumer.java
index 029ab13..c364277 100644
--- a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConsumer.java
+++ b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConsumer.java
@@ -63,7 +63,14 @@ public class NatsConsumer extends DefaultConsumer {
     protected void doStop() throws Exception {
         super.doStop();
 
-        // TODO: Should we not unsubscribe first?
+        LOG.debug("Flushing Messages before stopping");
+        connection.flush();
+        
+        try {
+			connection.unsubscribe(sid);
+		} catch (Exception e) {
+			getExceptionHandler().handleException("Error during unsubscribing", e);
+		}
 
         LOG.debug("Stopping Nats Consumer");
         if (executor != null) {


[2/2] camel git commit: Fixed CS

Posted by ac...@apache.org.
Fixed CS


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ed4d1fa8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ed4d1fa8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ed4d1fa8

Branch: refs/heads/master
Commit: ed4d1fa896e3ca1e80b98c42ccdf051b1b24e90a
Parents: 939a895
Author: Andrea Cosentino <an...@gmail.com>
Authored: Tue Jan 19 15:12:58 2016 +0100
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Tue Jan 19 15:12:58 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/component/nats/NatsConsumer.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ed4d1fa8/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConsumer.java b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConsumer.java
index c364277..7b77b16 100644
--- a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConsumer.java
+++ b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConsumer.java
@@ -67,10 +67,10 @@ public class NatsConsumer extends DefaultConsumer {
         connection.flush();
         
         try {
-			connection.unsubscribe(sid);
-		} catch (Exception e) {
-			getExceptionHandler().handleException("Error during unsubscribing", e);
-		}
+            connection.unsubscribe(sid);
+        } catch (Exception e) {
+            getExceptionHandler().handleException("Error during unsubscribing", e);
+        }
 
         LOG.debug("Stopping Nats Consumer");
         if (executor != null) {