[rabbitmq-discuss] Queuing fundamentals.
Andrew
aph at repido.co.uk
Mon Aug 1 18:49:01 BST 2011
Hi Eugene ,
My code is written in PHP and is using the PHP AMQP library (http://
www.php.net/manual/en/book.amqp.php) and in my calls to the consume()
method I am setting parameters that specify a minimum delivery of zero
messages and a maximum of one. This I had hoped would just get one
message from the queue at a time for me to process.
Certainly what you suggest would explain the behaviour so perhaps my
understanding of the parameters to the consume() method is wrong.
Do you think that what I am trying to achieve should in theory work?
If so, what should happen to message 3 after it's failed ACK? i.e.
should my next request to the queue retrieve it, or will it always be
delivered out of sequence after a failed ACK? If the latter is the
case, how do I achieve ordered delivery of my messages even when my
consume process dies and restarts?
Thanks,
Andrew
On Aug 1, 5:41 pm, Eugene Kirpichov <ekirpic... at gmail.com> wrote:
> I suppose that you haven't set the prefetch count to 1.
>
> So in fact you had messages 3,4,5,6 all delivered to you (so thought
> the broker) and when the consumer died, the broker requeued all of
> them in no particular sequence.
>
> 2011/8/1 Andrew <a... at repido.co.uk>:
>
>
>
>
>
>
>
>
>
> > Hi everybody,
>
> > I wondered if somebody might be able to clarify some behaviour for me
> > as I am getting confused about whether the scenario I am experiencing
> > is due to a lack of understanding of how RabbitMQ works or something
> > else.
>
> > I have one reader process which may die due to system failure and at
> > restart I'd like the same single consumer process to start up again
> > and pick up where it left off. So a summary of what I'd like to happen
> > is:
>
> > (1) My transmitter process sends and queues up messages 1, 2, 3, 4, 5
> > & 6.
> > (2) My single consumer process reads and acknowledges messages 1 and 2
> > in sequence.
> > (3) My consumer process reads message 3 and then dies without
> > acknowledging.
> > (4) I restart my consumer process which will request the next message,
> > which should be the unacknowledged message (3).
> > (5) My consumer process would then continue reading messages from the
> > queue (4, 5, & 6) in sequence.
>
> > What I am experiencing is that when my consumer process is restarted
> > messages 3, 4, 5 & 6 are delivered out of sequence and all with a
> > redelivery count of 1. I understand that message 3 might be out of
> > sequence because it was unacknowledged and from what I have read, when
> > a message is redelivered then it's sequence is no longer guaranteed.
> > However I'm not clear as to why the remaining queued messages are out
> > of sequence too.
>
> > More importantly is what I am trying to do is something that is
> > contrary to how RabbitMQ works, or am I just going about it the wrong
> > way?
>
> > Many thanks for your help,
> > Andrew
>
> > _______________________________________________
> > rabbitmq-discuss mailing list
> > rabbitmq-disc... at lists.rabbitmq.com
> >https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
> --
> Eugene Kirpichov
> Principal Engineer, Mirantis Inc.http://www.mirantis.com/
> Editor,http://fprog.ru/
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
More information about the rabbitmq-discuss
mailing list