[rabbitmq-discuss] Receiving Undelivered Persistent Messages
Vidit Drolia
viditdrolia at gmail.com
Mon Aug 10 15:32:47 BST 2009
Matthias,
I am using RabbitMQ Java AMQP library ver. 1.6.0. PFA the scratch code
for the Consumer and Producer. You will have to pass in the username
and password as command line arguments.
On Mon, Aug 10, 2009 at 4:16 AM, Matthias Radestock<matthias at lshift.net> wrote:
> Vidit,
>
> Vidit Drolia wrote:
>
>> When a consumer's channel is closed, then all unacknowledged messages
>> are still available in the queue for subsequent consumers. If there
>> are N messages in the queue when the last consumer died, then when a
>> new consumer fires up, 1 message is delivered when the consumer
>> requests for a message by subscription. That is to say, executing:
>>
>> while(true){
>> delivery = consumer.nextDelivery();
>> //do something...
>> //acknowledge for delivery
>> }
>>
>> will deliver 1 message leaving N-1 messages in the queue. However,
>> after one execution of the above loop, the consumer keeps waiting for
>> the next delivery, even though there are N-1 messages in the queue. My
>> question was, is this supposed to happen by design of a subscription.
>
> No, that is not supposed to happen. If there are N messages in the queue and
> you have one consumer connecting to it and consuming messages as you
> describe then that consumer should receive all the messages.
>
> What client are you using? Can you post all the code to reproduce this?
>
>
> Regards,
>
> Matthias.
>
--
Vidit Drolia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: QueueConsumer.java
Type: text/x-java
Size: 2305 bytes
Desc: not available
Url : http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090810/74b54d4a/attachment.java
-------------- next part --------------
A non-text attachment was scrubbed...
Name: QueueProducer.java
Type: text/x-java
Size: 1690 bytes
Desc: not available
Url : http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090810/74b54d4a/attachment-0001.java
More information about the rabbitmq-discuss
mailing list