org.springframework.integration.twitter.inbound
Class AbstractTwitterMessageSource<T>
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.twitter.inbound.AbstractTwitterMessageSource<T>
- All Implemented Interfaces:
- BeanFactoryAware, BeanNameAware, InitializingBean, Lifecycle, Phased, SmartLifecycle, NamedComponent, MessageSource, TrackableComponent
- Direct Known Subclasses:
- DirectMessageReceivingMessageSource, MentionReceivingMessageSource, TimelineUpdateReceivingMessageSource
public abstract class AbstractTwitterMessageSource<T>
- extends AbstractEndpoint
- implements MessageSource, TrackableComponent
Abstract class that defines common operations for receiving various types of
messages when using the Twitter API. This class also handles keeping track of
the latest inbound message it has received and avoiding, where possible,
redelivery of common messages. This functionality is enabled using the
MetadataStore
strategy.
- Since:
- 2.0
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getComponentName, getComponentType, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
configuration
protected volatile OAuthConfiguration configuration
tweets
protected final java.util.Queue<java.lang.Object> tweets
prefetchThreshold
protected volatile int prefetchThreshold
markerId
protected volatile long markerId
twitter
protected twitter4j.Twitter twitter
AbstractTwitterMessageSource
public AbstractTwitterMessageSource()
setConfiguration
public void setConfiguration(OAuthConfiguration configuration)
setShouldTrack
public void setShouldTrack(boolean shouldTrack)
- Specified by:
setShouldTrack
in interface TrackableComponent
getMarkerId
public long getMarkerId()
hasMarkedStatus
protected boolean hasMarkedStatus()
onInit
protected void onInit()
throws java.lang.Exception
- Description copied from class:
IntegrationObjectSupport
- Subclasses may implement this for initialization logic.
- Overrides:
onInit
in class IntegrationObjectSupport
- Throws:
java.lang.Exception
forwardAll
protected void forwardAll(java.util.List<T> tResponses)
getComparator
protected java.util.Comparator getComparator()
doStart
protected void doStart()
- Description copied from class:
AbstractEndpoint
- Subclasses must implement this method with the start behavior.
This method will be invoked while holding the
AbstractEndpoint.lifecycleLock
.
- Specified by:
doStart
in class AbstractEndpoint
doStop
protected void doStop()
- Description copied from class:
AbstractEndpoint
- Subclasses must implement this method with the stop behavior.
This method will be invoked while holding the
AbstractEndpoint.lifecycleLock
.
- Specified by:
doStop
in class AbstractEndpoint
receive
public Message<?> receive()
- Description copied from interface:
MessageSource
- Retrieve the next available message from this source.
Returns
null
if no message is available.
- Specified by:
receive
in interface MessageSource
forward
protected void forward(T tweet)
markLastStatusId
protected void markLastStatusId(long statusId)