Question

Can someone tell me whether MSMQ (using transactions) supports competing consumers? Basically, I have multiple threads dequeueing messages off of a single queue. Just wanted to make sure this will work since MSMQ sometimes behaves differently than I expect.

Was it helpful?

Solution

If you are calling Receive from multiple processes on the same machine on the same queue, you will not get the same message more than once -- unless you rollback a transaction from a read.

If you are using 2008/w7 and are receiving on multiple machines from the same remote queue within a transaction, you should not see the same message twice (again, unless you roll back).

If you are using an enumerator to peek the messages and then remove an interesting one (via RemoveCurrent), you should expect to see an exception that the message has already been removed if another consumer has picked it up.

If you are on 2003/XP, you cannot do remote receives in a transaction so all bets are off there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top