Hi,<br><br>I use Subscription from the RabbitMQ.Client.MessagePatterns namespace to subscribe to multiple queues. I then read messages based on the subscription (code below). However, I am not able to read messages other than the first one. i.e. Whether I try to read from multiple queues(subscriptions) or a single queue(subscription). I do Ack() at each iteration of the message reading. Could you see where the run time error originated at for me?<br>
<br>Thanks<br><br>private List<Subscription> subscriptions = new List<Subscription>();<br>Subscription sub = null;<br><br><br> public Measurement readMessage()<br> {<br> Measurement m = new Measurement();<br>
foreach(Subscription element in subscriptions)<br> {<br> if( element.QueueName == null)<br> {<br> m = null;<br> }<br> else <br>
{<br> BasicDeliverEventArgs ev = element.Next();<br> if( ev != null) {<br> m = Measurement.AltDeSerialize( ev.Body );<br> <a href="http://m.id">m.id</a> = element.QueueName;<br>
element.Ack();<br> return m;<br> }<br> m = null; <br> element.Ack();<br> <br> }<br>
} <br> System.Console.WriteLine("No message in the queue(s) at this time.");<br> return m;<br> }<br> <br> public void subscribeToQueue(string queueName) <br>
{ <br> sub = new Subscription(channel, queueName);<br> subscriptions.Add(sub); <br> }