通过 MSMQ 绑定的 WCF。如何检测消息何时移至有害队列?

发布于 2024-10-26 17:08:03 字数 1104 浏览 6 评论 0原文

我正在运行一个 WCF 客户端,该客户端通过 MsmqBinding 调用 WCF 服务。 框架为.Net 4.0,客户端和服务器运行在Windows Server 2008 R2上。 通道队列是事务性的。

该服务通过以下绑定参数托管: <代码> receiveErrorHandling =“移动” 接收重试计数=“3” 重试周期延迟=“00:00:20” 最大重试周期=“5”

鉴于 (​​(ReceiveRetryCount+1) * (MaxRetryCycles + 1)) 有效,这将导致 4*6 = 任何给定消息在移至有害子队列之前重试 24 次。

将 IErrorHandler 附加到我的服务时,我注意到在 wcf 子系统最终将消息移动到 ;poison 子队列之前,使用 MsmqPoisonMessageException 总共调用了 HandleError 6 次(对于有害消息)。

我想记录消息重试完成并将消息移动到有害队列的精确时间。在我看来,唯一的选择是计算某个消息出错的次数,并将该计数与绑定的 MaxRetryCycles 进行比较。这是尴尬且容易出错的。

我的问题是:

  • 有什么办法可以让我 最终检测到事件 wcf子系统移动消息 到毒药队列?

我的参考资料是: http://msdn.microsoft.com/en-us/library/aa395218.aspx

并且:http://consultingblogs.emc.com/simonevans/archive/2007/09/17/A-compressive-guide-to-using-MsmqIntegrationBinding-with-MSMQ-3.0-in -WCF.aspx

I am running a WCF client that invokes a WCF service via an MsmqBinding.
Framework is .Net 4.0, client and server runs on Windows Server 2008 R2.
The channel queue is transactional.

The service is hosted with these binding parameters:

receiveErrorHandling="Move"
receiveRetryCount="3"
retryCycleDelay="00:00:20"
maxRetryCycles="5"

Given that ((ReceiveRetryCount+1) * (MaxRetryCycles + 1)) is in effect, this will result in
4*6 = 24 retries of any given message before it is moved to the poison subqueue.

Attaching an IErrorHandler to my service I notice that HandleError is called with a MsmqPoisonMessageException a total of 6 times (for a poison message), before the wcf subsystem finally moves the message to the ;poison subqueue.

I want to log the precise time when a message is done being retried and the message is moved to the poison queue. It seems to me the only option is to count the number of times a certain message faults and compare this count with the binding MaxRetryCycles. This is awkward and errorprone.

My question is:

  • Is there any way for me to
    conclusively detect the event where
    the wcf subsystem moves the message
    to the poison queue?

My references are:
http://msdn.microsoft.com/en-us/library/aa395218.aspx

And: http://consultingblogs.emc.com/simonevans/archive/2007/09/17/A-comprehensive-guide-to-using-MsmqIntegrationBinding-with-MSMQ-3.0-in-WCF.aspx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小矜持 2024-11-02 17:08:04

重试次数当然是您的参数的结果;然而,在 IErrorHandler 中,您可以自己显式地将消息移至有害队列。否则,它将始终根据您的绑定参数移动,并且可以像任何其他队列一样通过监听毒队列来检测到。

The number of retries is of course an outcome of your parameters; however in your IErrorHandler you can explicitly move the message to the poison queue yourself. Otherwise, it will always move based on your binding parameters, and would be detected by listening to the poison queue like any other queue.

我乃一代侩神 2024-11-02 17:08:04

有许多好的监视解决方案可用于监视消息队列中消息的到达。 MonitorWang 是一款开源软件,可以检测邮件何时到达有害邮件或错误队列。检测错误队列中何时接收消息比尝试检测何时发送更可靠到错误队列。

There are a number of good monitoring solutions that you can use to watch message queues for the arrival of a message. MonitorWang is an open source one that can detect when a message has arrived in a poison message or error queue. Detecting when a message has been received in the error queue is more reliable than trying to detect when a message has been sent to the error queue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文