camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1429708 - in /camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter: TwitterConfiguration.java TwitterEndpointPolling.java consumer/Twitter4JConsumer.java
Date Mon, 07 Jan 2013 08:46:15 GMT
Author: ningjiang
Date: Mon Jan  7 08:46:15 2013
New Revision: 1429708

URL: http://svn.apache.org/viewvc?rev=1429708&view=rev
Log:
CAMEL-5937 Added sinceId option for camel-twitter pulling the status

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

Modified: camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java?rev=1429708&r1=1429707&r2=1429708&view=diff
==============================================================================
--- camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
(original)
+++ camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
Mon Jan  7 08:46:15 2013
@@ -76,6 +76,12 @@ public class TwitterConfiguration {
      * Used for time-based endpoints (trends, etc.)
      */
     private String date;
+    
+    /**
+     * Used to set the sinceId from pulling
+     */
+    private long sinceId  = 1;
+    
     private Date parsedDate;
     private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 
@@ -244,6 +250,15 @@ public class TwitterConfiguration {
 
         return twitterStream;
     }
+    
+    public long getSinceId() {
+        return sinceId;
+    }
+
+    public void setSinceId(long sinceId) {
+        this.sinceId = sinceId;
+    }
+
 }
 
 

Modified: camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java?rev=1429708&r1=1429707&r2=1429708&view=diff
==============================================================================
--- camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
(original)
+++ camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
Mon Jan  7 08:46:15 2013
@@ -39,6 +39,8 @@ public class TwitterEndpointPolling exte
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
         Twitter4JConsumer twitter4jConsumer = Twitter4JFactory.getConsumer(this, getEndpointUri());
+        // update the sinceId
+        twitter4jConsumer.setLastId(properties.getSinceId());
         Consumer tc = new TwitterConsumerPolling(this, processor, twitter4jConsumer);
         configureConsumer(tc);
         return tc;

Modified: camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/Twitter4JConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/Twitter4JConsumer.java?rev=1429708&r1=1429707&r2=1429708&view=diff
==============================================================================
--- camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/Twitter4JConsumer.java
(original)
+++ camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/Twitter4JConsumer.java
Mon Jan  7 08:46:15 2013
@@ -61,4 +61,12 @@ public abstract class Twitter4JConsumer 
      * Called by direct consumers.
      */
     public abstract List<? extends Serializable> directConsume() throws TwitterException;
+    
+    /**
+     * Support to update the Consumer's lastId when starting the consumer
+     * @param sinceId
+     */
+    public void setLastId(long sinceId) {
+        lastId = sinceId;
+    }
 }



Mime
View raw message