Skip to main content
Go Search

Ayman El-Hattab's Blog [MVP]

Home
Ayman El-Hattab's Blog
Marwan Tarek's Blog
Mohamed Yehia's Blog
  

SharePoint 4 Arabs - Online SharePoint Training, Video Tutorials and Webcasts in Arabic > Ayman El-Hattab's Blog [MVP] > Posts > Querying MSMQ Messages Using LINQ
Querying MSMQ Messages Using LINQ
In a project that I'm currently working on, I needed to retrieve messages from MSMQ based on some criteria, I used LINQ to do that and would like to share this code with you. MessageQueue messageQueue = new MessageQueue(Constants.MessageQueueName); messageQueue.Formatter = new BinaryMessageFormatter(); var TrackingRecords = from System.Messaging.Message message in messageQueue where message.Label.Contains(Constants.MessageLabel) select (ICLGRecord)message.Body; // Itterate through the Messages foreach (var TrackingRecord in TrackingRecords) { } // Remove All Items From MSMQ messageQueue.Purge();

Comments

There are no comments yet for this post.