[rabbitmq-discuss] consumer.Queue.Dequeue() timeout if there are no messages

anate ambatinr at hotmail.com
Wed Apr 9 20:39:32 BST 2014


I have C# Console application. I am getting timeout consumer.Queue.Dequeue()
at this line when there are no messages in the queue. I would like to come
out from the program if there are no messages. How to handle this scenario?
Please let me know.

           using (IConnection connection =
connectionFactory.CreateConnection())
            {
                using (var channel = connection.CreateModel())
                {
                    channel.QueueDeclare("hello-world-queue", true, false,
false, null);
                    channel.BasicQos(0, 1, false);

                    var consumer = new QueueingBasicConsumer(channel);
                    channel.BasicConsume("hello-world-queue", false,
consumer);

                    while (true)
                    {
                        try
                        {
                            var ea =
(BasicDeliverEventArgs)consumer.Queue.Dequeue();



--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/consumer-Queue-Dequeue-timeout-if-there-are-no-messages-tp34711.html
Sent from the RabbitMQ mailing list archive at Nabble.com.


More information about the rabbitmq-discuss mailing list