[rabbitmq-discuss] Java Client Using DefaultConsumer vs QueueingConsumer

Michael Klishin mklishin at gopivotal.com
Thu Apr 3 16:04:08 BST 2014

On 3 April 2014 at 18:09:06, rails (stammailbox at gmail.com) wrote:
> > 1. My DemoConsumer inherits from DefaultConsumer
> I have noticed that working this way handleDelivery() is invoked 
> from ThreadPool.
> (printing Thread.currentThread().getName() I see pool-1-thread-1/2/3/4 
> eachtime.
> I have also tested it several times and saw that the order is saved. 
> Just to make sure - since different threads call handle delivery 
> - will it mess my order?

By default the pool has 5 threads, so yes. You can provide your own
executor on ConnectionFactory, e.g. to use a single threaded executor.

> 2. QueueingConsumer All of the java tutorial use QueueingConsumer 
> to consume messages.
> In the API Docs it is mentioned as a deprecated class.
> Should I change my code to inherit from DefaultConsumer use it? 
> Is the tutorial outdated?

I believe it was undeprecated after some of its limitations
were documented . On what pages do you see this mentioned?

Software Engineer, Pivotal/RabbitMQ

More information about the rabbitmq-discuss mailing list