开发者

Using Twitter4J and Twitters Streaming API

In this use-case I need to monitor Twitters stream for tweets with certain hash-tags and then pull those tweets out and store them. I am using Twitter4J for this and Twitters Streaming API. The hash-tags to monitor change frequently so I would like to refresh the filter every 10 minutes or so. When I refresh I am simply pulling all the new hash-tags from the data layer and passing them to the filter qu开发者_如何学编程ery. My two questions:

  • Is there anything wrong with stopping the connection every 10 minutes and refreshing (in terms of Twitters rate limits etc)

  • Is there anything to prevent me losing tweets that are made during the short refresh pause?

Thanks in advance.


You should not reconnect any more often than once every ten minutes, or you may be rate limited. You can form your new connection before dropping your old connection, which should help avoid data loss. Note that you may only have one outstanding connection at a time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜