[rabbitmq-discuss] Receiving Undelivered Persistent Messages

amit bhatnagar brownspice at gmail.com
Mon Aug 10 21:30:50 BST 2009


Vidit.

Check the consumer code. Probably a cut and paste error, but you are
creating the connection / channel and declaring the exchange and
bindings within the loop. This is probably what is causing you to
think you have received only one of the messages that is in the
queue.

On Aug 10, 8:32 am, Vidit Drolia <viditdro... at gmail.com> wrote:
> 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<matth... 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
>
>  QueueConsumer.java
> 3KViewDownload
>
>  QueueProducer.java
> 2KViewDownload
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc... at lists.rabbitmq.comhttp://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss




More information about the rabbitmq-discuss mailing list