使用 netMSMQ 绑定进行有序交付
使用 WCF netMSMQbinding 时是否可以保证有序交付?
我们将一个插入命令后跟多个更新命令放在同一个队列上,有时其中一个更新会击败插入命令。
添加了广泛的日志记录后,很明显它们正在以正确的顺序添加到队列中,并以不同的顺序进行处理。
我已经设法谷歌了几篇文章,指出这种行为是预期的,但似乎必须可以将其配置为以某种方式订购。
我们的队列是事务性的,所以我认为添加序列号并在目的地重新排序不会起作用,因为
如果我添加属性 [DeliveryRequirements(RequireOrderedDelivery=true, QueuedDeliveryRequirements=QueuedDeliveryRequirementsMode. Require)]
我收到以下错误:
合约“IService”上的 DeliveryRequirementsAttribute 指定了 QueuedDeliveryRequirements 值为 NotAllowed。 然而,配置的 该合约的绑定指定它支持排队交付。 A 排队绑定不能与此合约一起使用。
我不知道为什么我们会收到此错误,因为一切“似乎”都设置正确。 我还没有找到任何关于 MSMQ 允许此设置的确认信息,因为它似乎是 WS-RM 设置,并且 AFAIK netMSMQBinding 不支持 WS-RM。
Is it possible to guarantee ordered delivery when using WCF netMSMQbinding?
We are putting an insert command followed by a number of update commands on the same queue, and occassionally one of the updates beats the insert.
Having added extensive logging it is clear that they are being added to the queue in the correct order and being processed in a different order.
I have managed to Google a couple of articles that state that this behaviour is expected, but it seems like it must be possible to configure it to be ordered somehow.
Our queues are transactional, so I don't think that adding sequence numbers and resequencing at the destination is going to work, as that would lose out transactionality
If I add the attribute [DeliveryRequirements(RequireOrderedDelivery=true, QueuedDeliveryRequirements=QueuedDeliveryRequirementsMode.Require)]
I get the following error:
The DeliveryRequirementsAttribute on contract 'IService' specifies a
QueuedDeliveryRequirements value of NotAllowed. However, the configured
binding for this contract specifies that it does support queued delivery. A
queued binding may not be used with this contract.
I have no idea why we get this error, as everything "appears" to be setup correctly. I haven't managed to find any confirmation that this setting is allowed for MSMQ though, as it appears to be a WS-RM setting, and AFAIK netMSMQBinding does not support WS-RM.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MSMQ 不支持有序交付,因此您不能。
看一下 System.ServiceModel.Channels.MsmqBindingElementBase+BindingDeliveryCapabilityHelper,它是指定 MSMQ 绑定功能的类,以及它如何实现该属性:
MSMQ does not support ordered delivery, hence you can not.
Take a look at System.ServiceModel.Channels.MsmqBindingElementBase+BindingDeliveryCapabilitiesHelper which is the class specifying MSMQ's binding capabilities, and how it implements that property:
Simon Gittins 的这篇文章< /a> 看起来表明可以进行有序交付:
This post from Simon Gittins looks like it suggests that ordered delivery is possible:
看起来您可以对消息进行分组,因此您可以在合同中指定顺序。 请查看这篇有关对邮件进行分组的 MSDN 文章。
Looks like you can group messages, so therefore you could specify the order in the contract. Check out this MSDN article on grouping messages.