NServiceBus 无法引发传输消息已接收事件
场景:
- 我将 NServiceBus 与 MSMQ 传输结合使用。
- 我有来自某个应用程序的消息被放入 QUEUE-A 中。
- 我有一个 NServiceBus 网关从 QUEUE-A 抓取消息并将它们发送到另一个网关。
- 目标网关接收消息并将它们放入相应的队列中。
- 源网关抛出空引用异常并发送消息总共 5 次(最大重试次数)。
- 目标网关接收所有消息并在日志中显示它正在发送 HTTP 响应。
目标网关抛出的错误是:
WARNServiceBus.Unitcast.Transport.Msmq.MsmqTransport [(null)] <(null)> - 无法针对 ID=GUID 的消息引发“已收到传输消息”事件 System.NullReferenceException:未将对象引用设置为对象的实例。
这个错误最初是在两台不同的服务器上设置的,尽管当我在本地计算机上以管理员权限本地运行该场景时(仅侦听不同的端口),就会发生此错误。我将消息的 SetHttpToHeader() 设置为正确的目标地址。
网关配置如下:
Gateway1:
<appSettings>
<add key="NumberOfWorkerThreads" value="10"/>
<add key="InputQueue" value="Gateway1Pickup"/>
<add key="ErrorQueue" value="Gateway1Error"/>
<add key="ForwardReceivedMessageTo" value="audit"/>
<add key="OutputQueue" value="Gateway1Output"/>
<add key="ListenUrl" value="http://address:6768/Gateway/"/>
<add key="RequireMD5FromClient" value="true"/>
</appSettings>
Gateway2:
<appSettings>
<add key="NumberOfWorkerThreads" value="10"/>
<add key="InputQueue" value="Gateway2Pickup"/>
<add key="ErrorQueue" value="Gateway2Error"/>
<add key="ForwardReceivedMessageTo" value="audit"/>
<add key="OutputQueue" value="Gateway2Output"/>
<add key="ListenUrl" value="http://address:6768/Gateway/"/>
<add key="RequireMD5FromClient" value="true"/>
</appSettings>
有谁知道我哪里出错了?
Scenario:
- I'm using NServiceBus with MSMQ Transport.
- I have messages from an app dropped into QUEUE-A.
- I have a NServiceBus Gateway grab messages from QUEUE-A and send them to another Gateway
- I the Destination Gateway receives the messages and places them into the respective queue.
- Source Gateway throws a Null Reference Exception and send the messages 5 total times (max retries).
- Destination Gateway receives all messages and shows that it's Sending the HTTP response in the log.
The error that the Destination Gateway throws is:
WARN NServiceBus.Unitcast.Transport.Msmq.MsmqTransport [(null)] <(null)> - Failed raising 'transport message received' event for message with ID=GUID
System.NullReferenceException: Object reference not set to an instance of an object.
This error initially was setup on 2 different servers though it occurs when I run the scenario locally, under admin rights, on my local computer (just listening on different ports). I'm setting the SetHttpToHeader() of the message to the proper destination address.
The gateway configs are as follows:
Gateway1:
<appSettings>
<add key="NumberOfWorkerThreads" value="10"/>
<add key="InputQueue" value="Gateway1Pickup"/>
<add key="ErrorQueue" value="Gateway1Error"/>
<add key="ForwardReceivedMessageTo" value="audit"/>
<add key="OutputQueue" value="Gateway1Output"/>
<add key="ListenUrl" value="http://address:6768/Gateway/"/>
<add key="RequireMD5FromClient" value="true"/>
</appSettings>
Gateway2:
<appSettings>
<add key="NumberOfWorkerThreads" value="10"/>
<add key="InputQueue" value="Gateway2Pickup"/>
<add key="ErrorQueue" value="Gateway2Error"/>
<add key="ForwardReceivedMessageTo" value="audit"/>
<add key="OutputQueue" value="Gateway2Output"/>
<add key="ListenUrl" value="http://address:6768/Gateway/"/>
<add key="RequireMD5FromClient" value="true"/>
</appSettings>
Does anyone know where I'm going wrong on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
起初我得到了可靠的重现,然后我意识到 NSB 不会为您创建审核队列。如果您从配置中删除它们或创建审核队列,那么您应该已准备就绪。
At first I got a solid repro and then I realized that NSB does not handle creating the Audit queues for you. If you remove them from the config or create the Audit queues, you should be all set.
我发现当我的服务目录中没有一些依赖程序集时,就会出现上述问题。我发现 MSMQ 队列中的消息附加了错误。我使用了队列资源管理器,但我认为其他工具也会显示相同的结果。
I found this above problem showed up when I didn't have some dependent assemblies in the service directory. I found the error attached to the message in the MSMQ queue. I used Queue Explorer, but I presume other tools would show the same.