简体   繁体   English

MSMQ竞争消费者

[英]MSMQ competing consumer

Can someone tell me whether MSMQ (using transactions) supports competing consumers? 有人能告诉我MSMQ(使用交易)是否支持竞争消费者? 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. 只是想确保这个有效,因为MSMQ的行为有时与我预期的不同。

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. 如果您在同一队列上的同一台计算机上调用来自多个进程的Receive,则不会多次获得相同的消息 - 除非您从读取回滚事务。

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). 如果您正在使用2008 / w7并且在事务中从同一远程队列中的多台计算机上接收,则不应该两次看到相同的消息(同样,除非您回滚)。

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. 如果您使用枚举器来查看消息然后删除一个有趣的消息(通过RemoveCurrent),您应该会看到一个例外,如果另一个消费者已经将其删除,则该消息已被删除。

If you are on 2003/XP, you cannot do remote receives in a transaction so all bets are off there. 如果您使用的是2003 / XP,则无法在交易中进行远程接收,因此所有投注都在那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM