[rabbitmq-discuss] .NET client - prefetch issue

Just Looking just.looking.76 at gmail.com
Fri Nov 9 16:48:15 GMT 2012


Hello

Firstly, new to rabbit-mq, great product, very comprehensive. Im working on 
a simple test rig as a proof of concept.


I have created a .net consumer with the following code

<connection stuff>
using (IConnection conn = factory.CreateConnection())
            {
                using (var channel = conn.CreateModel())
                {
                    channel.BasicQos(0, 1, false);
                    channel.ExchangeDeclare(exchangeName, 
ExchangeType.Direct, true, false, null);
                    channel.QueueDeclare(queueName, true, false, false, 
null);
                    channel.QueueBind(queueName, exchangeName, 
"optional-routing-key");

                    using (var subscription = new Subscription(channel, 
queueName, false))
                    {
                        while (channel.IsOpen)
                        {
                            try
                            {
                                BasicDeliverEventArgs ev;
                                bool messageReceived = 
subscription.Next(1000, out ev);
                                if (messageReceived)
                                {
                                    <stuff>
                                    channel.BasicAck(ev.DeliveryTag, false);
                                }
                                else
                                {
                                    Thread.Sleep(100);
                                }
                            }
                            catch (OperationInterruptedException ex)
                            {
                                break;
                            }
                        }

                    }


I am having trouble getting the QOS to work. In a scenario where I have 
published lots of large messages to a queue, the consumer is still getting 
a large number of messages and eventually running out of memory (as the 
messages are around 7MB each) before it sends the ack. 

I think i have configured to channel QOS correctly, but no matter what i 
set it to it seems to always prefetch whatever exists on the queue.

Using client 2.6.1 with server *2.8.7 (is that the problem?) and Erlang **R15B02 
on Windows 7 *

Any advice appreciated
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20121109/e91d0bfb/attachment.htm>


More information about the rabbitmq-discuss mailing list