2011-08-08 108 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配置文件中? –