NServiceBus 消息处理程序不会出现“错误”异常时排队
我有一个示例 NServiceBus 应用程序来测试水域。一切都很顺利,发送和处理工作正常。
我故意在某个消息处理程序中抛出异常来看看会发生什么 - 但什么也没有发生。异常已正确记录到控制台,但消息已从队列中拉出,并且没有按照我的预期放置在错误队列中。而且,重试5次也没有发生。这是正确的行为吗?
此外,首次指定时,队列是在启动时正确创建的。
服务器的配置和引导代码(处理程序所在的位置如下)
config:
<MsmqTransportConfig
InputQueue="SiteServer1"
NumberOfWorkerThreads="1"
MaxRetries="5"
ErrorQueue="SiteServer1Errors"
/>
program.cs:
var bus = NServiceBus.Configure.With()
.Log4Net()
.CastleWindsorBuilder(container)
.XmlSerializer()
.MsmqTransport()
.UnicastBus()
.LoadMessageHandlers()
.CreateBus()
.Start();
我在这里遗漏了什么吗?
I have a sample NServiceBus application to test the waters.. All is going well, sending and handling is working correctly.
I have deliberately thrown an exception within a certain message handler to see what happens - but nothing does. The exception is logged correctly to the console, yet the message is pulled off the queue and NOT placed in the error queue as I'd expect. Also, the 5 times retry didn't occur either. Is this correct behaviour?
Also, the queue was created correctly at startup when first specified.
the config and bootstrap code for the server (where the handler resides are below)
config:
<MsmqTransportConfig
InputQueue="SiteServer1"
NumberOfWorkerThreads="1"
MaxRetries="5"
ErrorQueue="SiteServer1Errors"
/>
program.cs:
var bus = NServiceBus.Configure.With()
.Log4Net()
.CastleWindsorBuilder(container)
.XmlSerializer()
.MsmqTransport()
.UnicastBus()
.LoadMessageHandlers()
.CreateBus()
.Start();
Am I missing anything here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我修改了引导程序代码以包含
在总线配置中,现在它可以工作了!看来非事务性消息是一次性的。有道理!
I modified the bootstrapper code to include
on the bus config and now it is working! It seems that non-transactional messages are disposable. Makes sense!
您运行的是 Windows Server 2008 吗?如果是这样,您将在事件查看器中的应用程序事件日志 -> 下找到事件日志。窗口 -> MSMQ - 端到端。这将记录 MSMQ 子系统在您的计算机上执行的每个操作。
我猜测 NSB 已尝试将消息发送到错误队列。然而,真正发生的情况是,您计算机上的 MSMQ 子系统已使用该消息,但由于某种原因无法将其传递到错误队列。
我会查看 MSMQ 日志以了解发生了什么。
Are you running Windows Server 2008? If so you will find an event log in the event viewer, under the Application event logs -> windows -> MSMQ - End2End. This will record every action taken by the MSMQ subsystem on your machine.
I am guessing that NSB has tried to send the message to the error queue. However, what is really hapenning is that the MSMQ subsystem on your machine has consumed the message, but not been able to deliver it to the error queue for some reason.
I would look in the MSMQ log for an idea of what is going on.