我有以下设置: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配置文件中? –