Class TwitterStreamProvider
java.lang.Object
com.northconcepts.datapipeline.twitter.TwitterStreamProvider
Streaming Twitter service provider.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTwitterStreamProvider(String consumerKey, String consumerSecret) Creates a provider that uses application-only (OAuth 2 bearer token) authentication.TwitterStreamProvider(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) Creates a provider that authenticates with the given user access token, or application-only if it is empty. -
Method Summary
Modifier and TypeMethodDescriptionaddExceptionProperties(DataException exception) Returns the exception unchanged; subclasses can override to add provider details.voidclose()Shuts down the stream if one was created; a later reader open creates a new one.ConfigurationBuilderReturns the twitter4j configuration applied when the stream is created (when a reader is opened).Returns the HTTP proxy host, applied when the stream is created (when a reader is opened).Returns the HTTP proxy port, applied when the stream is created (when a reader is opened).protected TwitterStreamReturns the stream, creating it on first use with the configured credentials and proxy.voidDoes nothing; the stream is created when a reader is opened.setHttpProxyHost(String httpProxyHost) Sets the HTTP proxy host, applied when the stream is created (when a reader is opened).setHttpProxyPort(Integer httpProxyPort) Sets the HTTP proxy port, applied when the stream is created (when a reader is opened).
-
Field Details
-
consumerKey
-
consumerSecret
-
accessToken
-
accessTokenSecret
-
-
Constructor Details
-
TwitterStreamProvider
Creates a provider that uses application-only (OAuth 2 bearer token) authentication. -
TwitterStreamProvider
public TwitterStreamProvider(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) Creates a provider that authenticates with the given user access token, or application-only if it is empty.
-
-
Method Details
-
getConfig
public ConfigurationBuilder getConfig()Returns the twitter4j configuration applied when the stream is created (when a reader is opened). -
getHttpProxyHost
Returns the HTTP proxy host, applied when the stream is created (when a reader is opened). -
setHttpProxyHost
Sets the HTTP proxy host, applied when the stream is created (when a reader is opened). -
getHttpProxyPort
Returns the HTTP proxy port, applied when the stream is created (when a reader is opened). -
setHttpProxyPort
Sets the HTTP proxy port, applied when the stream is created (when a reader is opened). -
open
Does nothing; the stream is created when a reader is opened.- Throws:
DataException
-
close
Shuts down the stream if one was created; a later reader open creates a new one.- Throws:
DataException
-
getTwitterStream
protected TwitterStream getTwitterStream()Returns the stream, creating it on first use with the configured credentials and proxy. -
addExceptionProperties
Returns the exception unchanged; subclasses can override to add provider details.
-