I am trying to use the Twitter4j API to track twitts according to some rule criteria. The API works fine when there is one rule, but when I am adding two or three rules I am getting this error:
420:Returned by the Search and Trends API when you are being rate limited (https://dev.twitter.com/docs/rate-limiting).
Returned by the Streaming API:
Too many login attempts in a short period of time.
Running too many copies of the same application authenticating with the same account name.
Exceeded connection limit for user
The code I’m using is:
// create the TwitterStream object
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(false).setOAuthConsumerKey(accountdetails.ConsumerKey)
.setOAuthConsumerSecret(accountdetails.ConsumerSecret)
.setOAuthAccessToken(accountdetails.AccessToken)
.setOAuthAccessTokenSecret(accountdetails.AccessTokenSecret)
Configuration config = cb.build();
TwitterStream twitterStream = new
TwitterStreamFactory(config).getInstance();
// create the filter
FilterQuery filter = new FilterQuery();
filter.track(trackList);
// create the Listener object
// Twitter4jListener is a class that implements the StatusListener interface
Twitter4jListener listener = new Twitter4jListener(rule);
twitterStream.addListener(listener);
twitterStream.filter(filter);
Do I use the API incorrectly? or the API generally have a limit on a number of Listeners that can work in parallel?