NServiceBus,为什么我可以Bus.Send,但不能Bus.Publish?需要帮助调试
好的,
简单介绍一下背景
我们使用的 NServiceBus 2.0 几乎是标准配置,没有发生任何“疯狂”的情况。
应用程序是 .NET 3.5
开发环境是发布者和订阅者位于同一个机器上,Windows 7。
暂存环境是发布者和订阅者位于不同的机器上,一个是 Windows 7,另一个是 Windows Server 2008。
行为
在开发环境中,发布者订阅者工作正常,这表明代码本身在启动、配置容器等方面没有问题,并且所有消息都配置正确,即大小、序列化等。
在登台环境中,发布者成功接收订阅请求。
它还成功将订阅者存储在订阅表(SQL Server,我们使用 DBSubscription)中,并且“queuename@machinename”是正确的。
问题
Bus.Publish() 没有任何反应。没有创建传出队列,没有在任何地方发送或创建消息,也没有抛出错误。
额外信息
有趣的是,来自发布者的 Bus.Send 工作正常!当然,我必须将其添加到配置中:
<单播总线配置> <消息端点映射>
>; 发布者也可以解析:
ping 机器名
那么,发生了什么事,我应该注意什么?
为什么 SEND 有效,而 PUBLISH 无效?
我怎样才能让发布工作?
Ok,
Quick background
We're using NServiceBus 2.0 with pretty much the standard config, nothing "crazy" going on.
App is .NET 3.5
Dev environment is Publisher and Subscriber are on the same box, Windows 7.
Staging environment is Publisher and Subscriber are on different boxes, one Windows 7, the other Windows Server 2008.
Behaviour
On the Dev environment, Publisher Subscriber work fine, which suggests the code itself is ok in term on Starting Up, Configuring Containers etc, and all the messages being configured correctly, i.e size, serialization etc.
On the Staging environment, the Publisher SUCCESSFULLY receives the subscription request.
It also successfully stores the subscriber in the Subscription table (SQL Server, we're using DBSubscription), and the "queuename@machinename" is correct.
Problem
On Bus.Publish() nothing happens. No Outgoing Queue is created, no message sent or created anywhere, no error is thrown.
Extra Info
Interestingly a Bus.Send from the Publisher works fine! except of course I have to add this to the config:
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="Library.Messages" Endpoint="subscriberqueue@machinename"/>
</MessageEndpointMappings>
</UnicastBusConfig>Also the Publisher CAN resolve:
ping machinename
SO, what's going on, and what should I be looking out for?
Why does SEND work, and PUBLISH doesn't?
How can I get PUBLISH working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
打开日志记录阈值进行调试,并查看发布者在调用发布期间是否记录“正在发送消息到...”。
Turn the logging threshold to debug and see if the publisher logs "sending message to..." during the call to publish.