[rabbitmq-discuss] Why is the "select" always getting timed out in consumer?

Alan Antonuk alan.antonuk at gmail.com
Fri Dec 13 15:43:06 GMT 2013


Raj;

The problem with your above code is that you've put the socket descriptor
in non-blocking mode and rabbitmq-c doesn't expect this, so when it tries
to recv() it gets a error it doesn't understand.

Instead of using select() directly, I'd suggest using a higher-level
non-blocking API such as
amqp_consume_message()<https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp.h#L2151>
to
wait for a message with a time-out.  An example of how to use this API can
be found in the
amqp_consumer.c<https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_consumer.c>example.

HTH
-Alan


On Fri, Dec 13, 2013 at 7:29 AM, kingsmasher1 <raj.kumar.sanpui at gmail.com>wrote:

> We are actually using amqp_basic_consume(  ).
> I see the difference between them:
> https://github.com/alanxz/rabbitmq-c/issues/37
>
> Thus, to check indeed there are any messages in the queue, i will have to
> keep on calling basic.get in a loop, that's as good as a blocking call
> like,
> basic.consume
>
> [Regarding your earlier reply about select( ), the file descriptor becomes
> readable when, if there are any messages in the queue, right?]
>
> The best is:
> Do we have any API which can just check how many (or if there is any)
> message in the queue?
>
>
>
> --
> View this message in context:
> http://rabbitmq.1065348.n5.nabble.com/Why-is-the-select-always-getting-timed-out-in-consumer-tp32046p32069.html
> Sent from the RabbitMQ mailing list archive at Nabble.com.
> _______________________________________________
> 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/20131213/8730db59/attachment.html>


More information about the rabbitmq-discuss mailing list