2014-02-23 65 views
0

试图用nservicebus启动。我的意图是至少获得终端正在尝试订阅的日志消息。所以,我创建的消息处理程序的消息像自动订阅不起作用

namespace BusStop.Billing 
{ 
    public class OrderAcceptedHandler : IHandleMessages<OrderAccepted> 
    { 
     public void Handle(OrderAccepted message) 

和OrderAccepted被定义为

namespace BusStop.Sales.Contracts 
{ 
    public class OrderAccepted : IMessage 
    { 

按照NServiceBus文档的合同,应该是足够改变用户config文件

<UnicastBusConfig> 
    <MessageEndpointMappings> 
     <add Messages="BusStop.Sales.Contracts" Endpoint="BusStop.Backend"/> 

但是,当我开始订阅主机NServiceBus.Host.exe我没有得到它正在尝试订阅的日志消息,也没有订阅请求消息我n busstop.backend队列。

谢谢。

回答

1

好了,问题是,你也必须标记你的消息IEvent接口,因为这是

+1

正确的,因为只有标记为事件自动订阅V4消息。 –

+0

此外,管理消息模式的更好方法是不使用ICommand,IEvent,IMessage和引用NServiceBus,而是使用POCO类并定义约定,以便NServiceBus知道如何对POCO进行分类。有关更多信息,请参阅:http://particular.net/articles/unobtrusive-mode-messages –