By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,894 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,894 IT Pros & Developers. It's quick & easy.

MSMQ: removing all messages issue

P: n/a
Hi, I'm using MSMQ 3 under framework 2. All I want to do is retreive
all the messages on a queue and remove them.

If you use recieve on the queue you have to pass it a timespan which
defines the timeout for when there are no further messages. I could
set this to be stupidly small, but how small is safe, say if the
network has a blockage in it's tubes?
You can retrieve an enumerator using GetMessageEnumerator2 which has a
removeCurrent. However, this immediately causes the enumerator to stop
working (no real suprise) so is useless.

The queue has a GetAllMessages method which does as it says on the
tin, however, it doesn't remove them, and once retrieved, there's no
handy method to go in and delete them.

I could use a combination of GetAllMessages and then run through the
returned array once I'd finished with them doing receiveByID. This
would work, but what a waste.

Any ideas?
Jul 1 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.