[rabbitmq-discuss] rabbitmq-c non-block

Alan Antonuk alan.antonuk at gmail.com
Tue Jul 9 03:20:44 BST 2013


You might want to check out an API that I've added as of today:
amqp_consume_message():
https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp.h#L688

You can find an example on how to use it here:
https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_consumer.c#L81

To specify a timeout for that function you'd create a struct timeval

struct timeval timeout;
timeout.tv_sec = 5; /* Wait up to 5.0006 seconds */
timeout.tv_usec = 6000;

/* Pass timeval into amqp_consume_message() like so.
amqp_consume_message(conn, &envelope, &timeout, 0);

-Alan


On Mon, Jul 8, 2013 at 7:05 PM, 3k4b251 <314992959 at qq.com> wrote:

> can  you  give  me  some  example?
>
>
>
> --
> View this message in context:
> http://rabbitmq.1065348.n5.nabble.com/rabbitmq-c-non-block-tp27908p27912.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/20130708/3df7c694/attachment.htm>


More information about the rabbitmq-discuss mailing list