Running multiple rules listeners in Twitter4j



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     (
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();


Configuration config =;

TwitterStream twitterStream = new 

// create the filter

FilterQuery filter = new FilterQuery();

// create the Listener object

// Twitter4jListener is a class that implements the StatusListener interface
Twitter4jListener listener = new Twitter4jListener(rule);

Do I use the API incorrectly? or the API generally have a limit on a number of Listeners that can work in parallel?


The public Filter stream is only available for a single rule filter. You could try combining your two or three rules using a comma to represent an OR-like operator:

Rules on the public filter stream can be up to 500 characters. If you need multiple rules on a stream or longer and more complex rules, please contact Gnip: