public class TimelineReceivingMessageSource extends IntegrationObjectSupport
MessageSource
lets Spring Integration consume
given account's timeline as messages. It has support for dynamic throttling of API requests.logger
Constructor and Description |
---|
TimelineReceivingMessageSource(Twitter twitter,
String metadataKey) |
Modifier and Type | Method and Description |
---|---|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
long |
getLastProcessedId() |
protected int |
getPageSize() |
protected Twitter |
getTwitter() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected List<Tweet> |
pollForTweets(long sinceId)
Subclasses must implement this to return tweets.
|
Message<?> |
receive()
Retrieve the next available message from this source.
|
void |
setMetadataStore(MetadataStore metadataStore) |
void |
setPageSize(int pageSize)
Set the limit for the number of results returned on each poll; default 20.
|
void |
setPrefetchThreshold(int prefetchThreshold) |
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setMessageBuilderFactory, setTaskScheduler, toString
public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class IntegrationObjectSupport
protected List<Tweet> pollForTweets(long sinceId)
sinceId
- The id of the last reported tweet.public void setMetadataStore(MetadataStore metadataStore)
public void setPrefetchThreshold(int prefetchThreshold)
protected Twitter getTwitter()
protected int getPageSize()
public void setPageSize(int pageSize)
pageSize
- The pageSize.protected void onInit() throws Exception
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
Exception
- Any exception.public Message<?> receive()
MessageSource
null
if no message is available.receive
in interface MessageSource
@ManagedAttribute public long getLastProcessedId()
-1
if lastProcessedId is not set, yet.