public abstract class InstagramDataCollector<T> extends Object implements Runnable
Modifier and Type | Field and Description |
---|---|
protected BackOffStrategy |
backOffStrategy |
protected int |
consecutiveErrorCount |
protected Queue<StreamsDatum> |
dataQueue |
protected Instagram |
instagram |
protected AtomicBoolean |
isCompleted |
Constructor and Description |
---|
InstagramDataCollector(Instagram instagram,
Queue<StreamsDatum> queue,
InstagramConfiguration config)
InstagramDataCollector constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract StreamsDatum |
convertToStreamsDatum(T item)
Takes an Instagram Object and sets it as the document of a streams datum and sets the id of the streams datum.
|
protected Instagram |
getNextInstagramClient()
If there are authorized tokens available, it sets a new token for the client and returns
the client.
|
boolean |
isCompleted() |
protected int |
numAvailableTokens()
Return the number of available tokens for this data collector.
|
protected void |
queueData(Collection<T> userData,
String userId)
Queues the Instagram data to be output by the provider.
|
String |
swapUsernameForId(String username) |
protected Queue<StreamsDatum> dataQueue
protected AtomicBoolean isCompleted
protected int consecutiveErrorCount
protected BackOffStrategy backOffStrategy
protected Instagram instagram
public InstagramDataCollector(Instagram instagram, Queue<StreamsDatum> queue, InstagramConfiguration config)
queue
- Queue of StreamsDatumconfig
- InstagramConfigurationprotected Instagram getNextInstagramClient()
protected int numAvailableTokens()
protected void queueData(Collection<T> userData, String userId)
userData
- data to queueuserId
- user id who the data came frompublic boolean isCompleted()
protected abstract StreamsDatum convertToStreamsDatum(T item)
item
- itemCopyright © 2018 The Apache Software Foundation. All rights reserved.