diff --git a/examples/bin/examples/twitter/before.sh b/examples/bin/examples/twitter/before.sh index a65221dbb02..ffcbac42c58 100755 --- a/examples/bin/examples/twitter/before.sh +++ b/examples/bin/examples/twitter/before.sh @@ -13,10 +13,16 @@ if [ ! -e "$PF" ]; then touch created touch $PF chmod 700 $PF - echo " Your twitter user login name and pw is needed " - read -p 'twitter username? ' TWIT_USER - read -s -p 'twitter password? ' TWIT_PW - echo "user=${TWIT_USER}" >> $PF - echo "password=${TWIT_PW}" >> $PF - TWIT_PW="" + echo " Your twitter OAuth information is needed. Go to https://twitter.com/oauth_clients/new to register a new application and retrieve your keys " + read -p 'Twitter consumer key? ' CONSUMER_KEY + read -p 'Twitter consumer secret? ' CONSUMER_SECRET + read -p 'Twitter access token? ' ACCESS_TOKEN + read -p 'Twitter access token secret? ' ACCESS_TOKEN_SECRET + echo "debug=true" >> $PF + echo "oauth.consumerKey=${CONSUMER_KEY}" >> $PF + echo "oauth.consumerSecret=${CONSUMER_SECRET}" >> $PF + echo "oauth.accessToken=${ACCESS_TOKEN}" >> $PF + echo "oauth.accessTokenSecret=${ACCESS_TOKEN_SECRET}" >> $PF + CONSUMER_SECRET="" + ACCESS_TOKEN_SECRET="" fi \ No newline at end of file diff --git a/examples/pom.xml b/examples/pom.xml index c9632a3334b..4a1cbc929ac 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -125,17 +125,17 @@ org.twitter4j twitter4j-core - 2.2.6 + 3.0.3 org.twitter4j twitter4j-async - 2.2.6 + 3.0.3 org.twitter4j twitter4j-stream - 2.2.6 + 3.0.3 diff --git a/examples/src/main/java/druid/examples/twitter/TwitterSpritzerFirehoseFactory.java b/examples/src/main/java/druid/examples/twitter/TwitterSpritzerFirehoseFactory.java index 590b8d0d670..e87b5e44de2 100644 --- a/examples/src/main/java/druid/examples/twitter/TwitterSpritzerFirehoseFactory.java +++ b/examples/src/main/java/druid/examples/twitter/TwitterSpritzerFirehoseFactory.java @@ -17,6 +17,7 @@ import twitter4j.StatusListener; import twitter4j.TwitterStream; import twitter4j.TwitterStreamFactory; import twitter4j.User; +import twitter4j.StallWarning; import java.io.IOException; import java.util.Arrays; @@ -31,7 +32,7 @@ import java.util.concurrent.TimeUnit; import static java.lang.Thread.sleep; /** - * Twitter "spritzer" Firehost Factory named "twitzer". + * Twitter "spritzer" Firehose Factory named "twitzer". * Builds a Firehose that emits a stream of * ?? * with timestamps along with ??. @@ -176,6 +177,11 @@ public class TwitterSpritzerFirehoseFactory implements FirehoseFactory { { ex.printStackTrace(); } + + @Override + public void onStallWarning(StallWarning warning) { + System.out.println("Got stall warning:" + warning); + } }; twitterStream.addListener(statusListener);