[rabbitmq-discuss] Why does the queue drop other messages after the first is consumed?

Gavin M. Roy gavinmroy at gmail.com
Mon Dec 16 19:32:53 GMT 2013


What library are you using?

basic.consume() is not quite as simple as your code would imply. While it is issuing a RPC request to start consuming, most libraries have some semantics around its use such as registering a callback or setting up behaviors for what happens when messages are received from RabbitMQ. I think there’s more to what’s going on than you realize.


From: Raj Kumar Sanpui Raj Kumar Sanpui
Reply: Discussions about RabbitMQ rabbitmq-discuss at lists.rabbitmq.com
Date: December 16, 2013 at 2:31:26 PM
To: Discussions about RabbitMQ rabbitmq-discuss at lists.rabbitmq.com
Subject:  Re: [rabbitmq-discuss] Why does the queue drop other messages after the first is consumed?  
Agreed, but something as simple as:

{{{
pthread_mutex_lock(&mutex);
basic.consume( );
pthread_mutex_unlock(&mutex);
}}}

Should not have any issues (unless the library you are using has), and there are no issues in above code, if you can see.




On Tue, Dec 17, 2013 at 12:40 AM, Alvaro Videla <videlalvaro at gmail.com> wrote:
Hi,

Well it might be the code is corrupting the channel state, RabbitMQ
will just act based on the order you send AMQP commands to it. If your
code sends those commands in the wrong order, then errors might
happen, for example ack'ing the wrong message or things like that.

RabbitMQ is a server, which means, it is not concerned on which
threading library your application is using, or even if it is using
threads at all. Your application will send "requests" to RabbitMQ and
RabbitMQ will service them. In this case the requests are AMQP
commands.

Regards,

Alvaro

On Mon, Dec 16, 2013 at 6:59 PM, Raj Kumar Sanpui
<raj.kumar.sanpui at gmail.com> wrote:
> @Alvaro: The same code works perfect, if there are no pthread_mutex_lock.
>
> Can Allan know anything about it.
> @Alan Antonuk: Alan, do you have any issue in your library with regard to
> thread locks (pthread_mutex_lock) ?
>
>
>
>
> On Tue, Dec 17, 2013 at 12:26 AM, Alvaro Videla <videlalvaro at gmail.com>
> wrote:
>>
>> Well, perhaps either your code or the AMQP library has that problem.
>> RabbitMQ doesn't know anything about application specific code.
>>
>> On Mon, Dec 16, 2013 at 6:48 PM, Raj Kumar Sanpui
>> <raj.kumar.sanpui at gmail.com> wrote:
>> > Seems like rabbitmq has an allergy towards thread locks.
>> > Invoke a consumer thread (basic.consume) calling pthread_mutex_lock( )
>> > and
>> > all but one message gets dropped. Same works absolutely fine, if no
>> > thread
>> > locks are used.
>> >
>> >
>> > On Mon, Dec 16, 2013 at 11:22 PM, Michael Klishin
>> > <mklishin at gopivotal.com>
>> > wrote:
>> >>
>> >> On 16 Dec 2013, at 21:47, Raj Kumar Sanpui <raj.kumar.sanpui at gmail.com>
>> >> wrote:
>> >>
>> >> > In between, do we have any man page for basic.consume?
>> >> >
>> >> > What does "no ack", "exclusive", "local" stands for?
>> >>
>> >> Ignore local. Exclusive means that there can only ever be one consumer
>> >> on
>> >> the queue.
>> >>
>> >> no ack means “no manual ack”, that is, you don’t intend to use manual
>> >> acknowledgements of
>> >> deliveries. See tutorial 2: http://www.rabbitmq.com/getstarted.html
>> >> and http://www.rabbitmq.com/amqp-0-9-1-reference.html#domain.no-ack
>> >>
>> >> MK
>> >>
>> >> Software Engineer, Pivotal/RabbitMQ
>> >>
>> >>
>> >> _______________________________________________
>> >> rabbitmq-discuss mailing list
>> >> rabbitmq-discuss at lists.rabbitmq.com
>> >> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>> >
>> >
>> >
>> > _______________________________________________
>> > rabbitmq-discuss mailing list
>> > rabbitmq-discuss at lists.rabbitmq.com
>> > https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>> >
>> _______________________________________________
>> rabbitmq-discuss mailing list
>> rabbitmq-discuss at lists.rabbitmq.com
>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

_______________________________________________  
rabbitmq-discuss mailing list  
rabbitmq-discuss at lists.rabbitmq.com  
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/20131216/c461f64f/attachment.html>


More information about the rabbitmq-discuss mailing list