2011-08-08 35 views
1

我有以下设置:NServiceBus不测试系统上发布

  • 一个服务叫做CoreHost应该接受ExecuteWorkflowByAttributeCommand这是Bus.Send它并发布WorkflowByAttributeExecuted之后。

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

的处理程序是这样的:

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 [email protected] 
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 [email protected] 
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 [email protected] 
// some log entries generated by the Handle method 

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

Subscribing [email protected] to message type MHP.Domain.Common.Core.Messaging.WorkflowByAttribute.WorkflowByAttributeExecuted, MHP.Domain.Common.Core, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null | 
Subscribing [email protected] to message type MHP.Domain.Common.Core.Messaging.WorkflowByAttribute.WorkflowByAttributeCommand, MHP.Domain.Common.Core, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null | 

的应用.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> 

回答

1

持久未存储的订阅。感谢AndreasÖhlund的帮助!

0

要知道,成功的,如果组件的版本和公钥令牌抱着你要发布的消息发布商只能评估订阅都在相同发布者和订阅者。

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

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

+0

版本匹配。我正在使用构建输出,将其复制到测试机器并停止工作:( – Zebi

+0

您是否正在使用事务性队列?如果没有,则可能会丢失消息。 –

+0

您是否持久存储您的订阅?Msmq或db?这个主机在lite配置文件中? –