Hi all, I am having trouble with a bit of MSMQ functionality that sends messages from an ASP.NET web application. Every MSMQ send message that is sent has a corresponding receive MSMQ message. Obviously sending the messages are straightforward but receiving them is proving very slow, I have the following method that takes care of receiving the messages: private XmlReader ReceiveMessage(string messageId) { _receiveQ = GetQueue(LawConfig.MSMQ.ReceiveMSMQ); Message message = null; while (_receiveQ.PeekByCorrelationId(messageId, _timeOut) != null) { message = _receiveQ.ReceiveByCorrelationId(messageId, _timeOut); if (message != null) break; } if (message == null) throw new Exception("No message in the receive queue."); XmlReader reader = GetXmlReader(message); return reader; } The ReceiveByCorrelationId seems very unefficient as from what I can gather, it iterates all the messages from the queue until it finds the correct message. Is there a more efficient way of handling this? =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com