我有以下設置: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>
版本匹配。我正在使用構建輸出,將其複製到測試機器並停止工作:( – Zebi
您是否正在使用事務性隊列?如果沒有,則可能會丟失消息。 –
您是否持久存儲您的訂閱?Msmq或db?這個主機在lite配置文件中? –