Does LINQ remove messages from MSMQ?
I am contemplating using LINQ to read messages off a queue, like this guy: http://www.sharepoint4arabs.com/AymanElHattab/Lists/Posts/Post.aspx?ID=8
开发者_C百科But I'm wondering if this consumes messages from the queue or not.
Ideally I'd like this to just peek at the messages, and leave them there until either formally consumed or entirely purged.
Of course, I could write some test code to try it out, but am under a time crunch.
Thanks for any tips!
The thing to look at and remember here is that LINQ (Language Integrated Query) isn't really doing anything special with the MQ in this scenario.
The consuming of the MQ is coming in the normal fashion new MessageQueue(...);
and the author is just interacting with the MessageQueue
IEnumerable
via LINQ.
So LINQ itself will not automatically remove the messages from the queue, unless the behavior is to remove during iteration.
Good document here:
http://blogs.msdn.com/b/motleyqueue/archive/2008/02/09/combining-linq-with-system-messaging.aspx
精彩评论