MSMQ competing consumer
Asked Answered
M

1

7

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.

Marna answered 9/10, 2009 at 20:41 Comment(2)
Are you peeking or receiving messages?Duff
I am receiving messages.Marna
E
6

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.

Eagan answered 13/10, 2009 at 10:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.