[rabbitmq-discuss] How to stop consuming message from selective queue

Subshiri S subshiri at gmail.com
Mon Apr 28 09:50:40 BST 2014


Thank you Alvaro. Here is the code
QueueingConsumer consumer = new QueueingConsumer(channel); 
channel.basicConsume("queue1", consumer); 
channel.basicConsume("queue3", consumer);  
while(true){ 
     Delivery delivery = consumer.nextDelivery(); 
     String msg = new String(delivery.getBody()); 
     channel.basicAck(delivery.getEnvelope().getDeliveryTag(), true);
}

I am using the same consumer object to retrieve the msgs from the queues. 
If I use the basicCancel, I cannot process the msg from other queues as 
well. Please correct me If am wrong. If I create new consumer for every 
queue and consume through the same channel. How do I retrieve the 
deliveries from more than one consumer. Please refer the code.

On Monday, April 28, 2014 1:35:36 PM UTC+5:30, Alvaro Videla wrote:
>
> Hi, 
>
> Yes, you can use basicCancel for a specific consumer. See here: 
> https://www.rabbitmq.com/amqp-0-9-1-quickref.html 
>
> Regards, 
>
> Alvaro 
>
> On Mon, Apr 28, 2014 at 9:30 AM, Subshiri S <subs... at gmail.com<javascript:>> 
> wrote: 
> > 
> >> 
> >> QueueingConsumer consumer = new QueueingConsumer(channel); 
> >> channel.basicConsume("queue1", consumer); 
> >> channel.basicConsume("queue3", consumer); 
> > 
> > 
> > Is it possible to stop consuming the messages from the queue "queue3" 
> alone 
> > dynamically? 
> > 
> > _______________________________________________ 
> > rabbitmq-discuss mailing list 
> > rabbitmq... at lists.rabbitmq.com <javascript:> 
> > https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss 
> > 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140428/4577098b/attachment.html>


More information about the rabbitmq-discuss mailing list