public class TwitterStreamProvider extends Object implements StreamsProvider, Serializable, DatumStatusCountable
Modifier and Type | Field and Description |
---|---|
protected com.twitter.hbc.core.endpoint.StreamingEndpoint |
endpoint |
protected TwitterStreamHelper |
processor |
static String |
STREAMS_ID |
Constructor and Description |
---|
TwitterStreamProvider() |
TwitterStreamProvider(TwitterStreamConfiguration config) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addDatum(Future<List<StreamsDatum>> future) |
void |
cleanUp() |
protected void |
drainTo(Queue<StreamsDatum> drain) |
TwitterStreamConfiguration |
getConfig() |
DatumStatusCounter |
getDatumStatusCounter() |
String |
getId() |
boolean |
isRunning() |
static void |
main(String[] args)
To use from command line:
Supply (at least) the following required configuration in application.conf:
twitter.oauth.consumerKey
twitter.oauth.consumerSecret
twitter.oauth.accessToken
twitter.oauth.accessTokenSecret
Launch using:
mvn exec:java -Dexec.mainClass=org.apache.streams.twitter.provider.TwitterStreamProvider -Dexec.args="application.conf tweets.json"
|
protected List<StreamsDatum> |
pollForDatum() |
void |
prepare(Object configurationObject) |
StreamsResultSet |
readCurrent() |
StreamsResultSet |
readNew(BigInteger sequence) |
StreamsResultSet |
readRange(org.joda.time.DateTime start,
org.joda.time.DateTime end) |
void |
setConfig(TwitterStreamConfiguration config) |
void |
startStream() |
public static final String STREAMS_ID
protected com.twitter.hbc.core.endpoint.StreamingEndpoint endpoint
protected TwitterStreamHelper processor
public TwitterStreamProvider()
public TwitterStreamProvider(TwitterStreamConfiguration config)
public static void main(String[] args)
args
- public TwitterStreamConfiguration getConfig()
public void setConfig(TwitterStreamConfiguration config)
public String getId()
getId
in interface StreamsOperation
public void startStream()
startStream
in interface StreamsProvider
public StreamsResultSet readCurrent()
readCurrent
in interface StreamsProvider
public StreamsResultSet readNew(BigInteger sequence)
readNew
in interface StreamsProvider
public StreamsResultSet readRange(org.joda.time.DateTime start, org.joda.time.DateTime end)
readRange
in interface StreamsProvider
public boolean isRunning()
isRunning
in interface StreamsProvider
public void prepare(Object configurationObject)
prepare
in interface StreamsOperation
public void cleanUp()
cleanUp
in interface StreamsOperation
public DatumStatusCounter getDatumStatusCounter()
getDatumStatusCounter
in interface DatumStatusCountable
protected boolean addDatum(Future<List<StreamsDatum>> future)
protected void drainTo(Queue<StreamsDatum> drain)
protected List<StreamsDatum> pollForDatum()
Copyright © 2018 The Apache Software Foundation. All rights reserved.