[rabbitmq-discuss] Why each time the call method channel.queueDeclarePassive(queueName) increment number of consumer?
Pascal Dergane
pascaldergane at gmail.com
Mon Dec 13 23:34:52 GMT 2010
Hi,
I don't understand something about getConsumerCount() method.
Following an example of my consumer Method according with tutorial. Each
time my loop call queueDeclarePassive, the consumerCounter is incremented. I
don't understand why, cause I re use always (each loop) the same consumer,
so I expect that the consumerCounter does not increment. Could you explain
these observation and confirm that is not a bug? (I use V2.2.0 of java
client with 2.2.0 rabbitMQ Server).
Thanks,
QueueingConsumer consumer = new QueueingConsumer(channel);
boolean messageHasBeenRecept = false;
while (!messageHasBeenRecept) {
declareOk = channel.queueDeclarePassive(queueName);
System.out.println("QueueName:" + queueName);
System.out.println("ConsumerCount:" + declareOk.getConsumerCount());
System.out.println("MessageCount:" + declareOk.getMessageCount());
boolean autoAck = false;
channel.basicConsume(queueName, autoAck, consumer);
QueueingConsumer.Delivery delivery = null;
try {
delivery = consumer.nextDelivery(timeOut);
} catch (InterruptedException ie) {
continue;
}
messageHasBeenRecept = (delivery != null);
if (messageHasBeenRecept) {
System.out.println("Message recept :)"
+ delivery.getBody().toString());
channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false);
} else {
System.err.println("No Message recept :(");
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101214/b6aa739a/attachment.htm>
More information about the rabbitmq-discuss
mailing list