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?