NServiceBus不在测试系统上发布

时间:2011-08-08 11:06:51

标签: c# .net messaging nservicebus

我有以下设置:

  • 一项名为CoreHost的服务应该收到ExecuteWorkflowByAttributeCommand Bus.Send,然后发布WorkflowByAttributeExecuted

  • 一个“客户端”使用Bus.Send执行命令并订阅了WorkflowByAttributeExecuted消息。

Handler看起来像这样:

    public void Handle(WorkflowByAttributeCommand message)
    {
        MessageLifetimeLogger.Info("Received WorkflowByAttribute Command", ...);

        var log = _executor.ExecuteWithLog(message.Attribute, 
                                           message.SerializedWorkItem,
                                           message.Id);
        Bus.Publish(new WorkflowByAttributeExecuted(message.Id, log));

        MessageLifetimeLogger.Info("Completed WorkflowByAttribute Command", ...);
    }

在我的开发机器上它运行正常但在我们的测试系统上却没有。

收到命令并且处理程序显然已执行(日志包含相应的条目)但未发布任何消息。

让我感到惊讶的是,两台机器上的日志看起来完全不同。

工作机器日志包含

Received message MHP.Domain.Common.Core.Messaging.WorkflowByAttribute.WorkflowByAttributeCommand, MHP.Domain.Common.Core, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null with ID 6e15d4f7-7aa7-4be3-bd80-e70497bc5051\66585 from sender TestServerQueue@PC-SB-11
Activating: WorkflowByAttributeHandler 
// some log entries generated by the Handle method
Sending message MHP.Domain.Common.Core.Messaging.WorkflowByAttribute.WorkflowByAttributeExecuted, MHP.Domain.Common.Core, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null with ID 6e15d4f7-7aa7-4be3-bd80-e70497bc5051\66587 to destination TestServerQueue@PC-SB-11.
WorkflowByAttributeHandler Done. 

其中,不工作的机器日志仅包含

Received message MHP.Domain.Common.Core.Messaging.WorkflowByAttribute.WorkflowByAttributeCommand, MHP.Domain.Common.Core, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null with ID 6e15d4f7-7aa7-4be3-bd80-e70497bc5051\66585 from sender TestServerQueue@PC-SB-11
// some log entries generated by the Handle method

但是,所有消息类型似乎都已成功注册:

Subscribing TestServerQueue@VM-SCRUM-VLOG to message type MHP.Domain.Common.Core.Messaging.WorkflowByAttribute.WorkflowByAttributeExecuted, MHP.Domain.Common.Core, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null |  
Subscribing TestServerQueue@VM-SCRUM-VLOG to message type MHP.Domain.Common.Core.Messaging.WorkflowByAttribute.WorkflowByAttributeCommand, MHP.Domain.Common.Core, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null |  

服务器的app.config看起来像

<MsmqTransportConfig
    InputQueue="CoreHostQueue"
    ErrorQueue="ErrorQueue"
    NumberOfWorkerThreads="1"
    MaxRetries="5" />

<UnicastBusConfig>
    <MessageEndpointMappings>
    </MessageEndpointMappings>
</UnicastBusConfig>

另一个包含消息映射

<MsmqTransportConfig
  InputQueue="TestServerQueue"
  ErrorQueue="ErrorQueue"
  NumberOfWorkerThreads="2"
  MaxRetries="5" />

<UnicastBusConfig>
  <MessageEndpointMappings>
    <add Messages="MHP.Domain.Common.Core.Messaging.WorkflowByAttribute.WorkflowByAttributeCommand, MHP.Domain.Common.Core" Endpoint="CoreHostQueue"/>
    <add Messages="MHP.Domain.Common.Core.Messaging.WorkflowByAttribute.WorkflowByAttributeExecuted, MHP.Domain.Common.Core" Endpoint="CoreHostQueue"/>
  </MessageEndpointMappings>
</UnicastBusConfig>

2 个答案:

答案 0 :(得分:1)

订阅中没有永久存储的订阅。感谢AndreasÖhlund的帮助!

答案 1 :(得分:0)

请注意,如果包含您要发布的邮件的程序集的版本和公钥标记在发布者和订阅者身上都相同,则发布者只会成功评估订阅。

原因是订阅者在启动时向发布者发送的订阅消息包含此信息。

检查存储在publishers订阅商店中的订阅消息,并确保版本/ PKT与订阅者匹配。