App.Config MessageEndpointMappings在NSB 3.3.8中不起作用

时间:2013-06-12 19:41:05

标签: nservicebus

在NSB的3.2.6版本中,我的端点映射在我的app配置中,如下所示:

<UnicastBusConfig>
  <MessageEndpointMappings>
    <add Messages="Foo.Bar.Baz1, Foo.Interfaces" Endpoint="Foo.Bar.Monitor" />
    <add Messages="Foo.Bar.Baz2, Foo.Interfaces" Endpoint="Foo.Bar.Monitor" />
    <add Messages="Foo.Bar.Baz3, Foo.Interfaces" Endpoint="Foo.Bar.Monitor" />
  </MessageEndpointMappings>
</UnicastBusConfig>

这很好用。当我升级到NSB 3.3.8时,我看到端点映射的API发生了变化,尤其是the Messages attribute was deprecated,所以我尝试将代码移植到其中一个新方法中。 他们都没有工作。以下是我尝试的三种不同方法:

<UnicastBusConfig>
  <MessageEndpointMappings>
    <add Assembly="Foo.Interfaces" Endpoint="Foo.Bar.Monitor" />
  </MessageEndpointMappings>
</UnicastBusConfig>
<UnicastBusConfig>
  <MessageEndpointMappings>
    <add Assembly="Foo.Interfaces" Namespace="Foo.Bar" Endpoint="Foo.Bar.Monitor" />
  </MessageEndpointMappings>
</UnicastBusConfig>
<UnicastBusConfig>
  <MessageEndpointMappings>
    <add Assembly="Foo.Interfaces" Type="Foo.Bar.Baz1" Endpoint="Foo.Bar.Monitor" />
    <add Assembly="Foo.Interfaces" Type="Foo.Bar.Baz2" Endpoint="Foo.Bar.Monitor" />
    <add Assembly="Foo.Interfaces" Type="Foo.Bar.Baz3" Endpoint="Foo.Bar.Monitor" />
  </MessageEndpointMappings>
</UnicastBusConfig>

使用上述任何一种方法,当我尝试发送Baz1时,我会收到InvalidOperationException: No destination specified for message(s): Foo.Bar.Baz1

值得注意的是,如果我故意在我的类型名称中输入拼写错误(例如Foo.Bar.Bazzzzz1),NSB在启动时会无法找到指定的类型时出现错误,表明某事必须发生在那些没有拼写错误的人身上。

可以解决此问题,方法是将我的端点直接指定为Send的参数,但NSB recommends not doing that

所以我的问题是:我的配置中是否仍然出错,或者这是NSB 3.3.8中的真正错误?

0 个答案:

没有答案