camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1406066 - /camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerPolling.java
Date Tue, 06 Nov 2012 07:59:55 GMT
Author: davsclaus
Date: Tue Nov  6 07:59:54 2012
New Revision: 1406066

URL: http://svn.apache.org/viewvc?rev=1406066&view=rev
Log:
CAMEL-5773: Ensure twitter consumer is started/stopped. Thanks to Brett Meyer for the patch.

Modified:
    camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerPolling.java

Modified: camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerPolling.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerPolling.java?rev=1406066&r1=1406065&r2=1406066&view=diff
==============================================================================
--- camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerPolling.java
(original)
+++ camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerPolling.java
Tue Nov  6 07:59:54 2012
@@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.component.twitter.TwitterEndpoint;
+import org.apache.camel.component.twitter.consumer.streaming.StreamingConsumer;
 import org.apache.camel.impl.ScheduledPollConsumer;
 
 /**
@@ -44,6 +45,22 @@ public class TwitterConsumerPolling exte
         setTimeUnit(TimeUnit.SECONDS);
     }
 
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        if (twitter4jConsumer instanceof StreamingConsumer) {
+            ((StreamingConsumer) twitter4jConsumer).doStart();
+        }
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        super.doStop();
+        if (twitter4jConsumer instanceof StreamingConsumer) {
+            ((StreamingConsumer) twitter4jConsumer).doStop();
+        }
+    }
+
     protected int poll() throws Exception {
         Iterator<? extends Serializable> i = twitter4jConsumer.pollConsume().iterator();
 



Mime
View raw message