在Nservicebus中将消息转发到远程端点

时间:2010-03-04 16:27:18

标签: nservicebus

在我的消息发布者配置中

 <MsmqTransportConfig
    InputQueue="EnformMessages"
    ErrorQueue="error"
    NumberOfWorkerThreads="1"
    MaxRetries="5"
  />
    <UnicastBusConfig ForwardReceivedMessagesTo="testqueue@cgy1-web01">
       <MessageEndpointMappings>
       <!-- publishers don't need to set this for their own message types -->
       </MessageEndpointMappings>
     </UnicastBusConfig>

我希望将发布到EnformMessages的消息复制到远程计算机上的队列中。似乎没有消息被发送到远程机器,尽管消息肯定是在本地接收的。远程侦听器的配置文件类似于

<MsmqTransportConfig
  InputQueue="worker"
  ErrorQueue="error"
  NumberOfWorkerThreads="1"
  MaxRetries="5"
  />

  <UnicastBusConfig>
    <MessageEndpointMappings>

      <add Messages="EnformMessages" Endpoint="testqueue" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

我也尝试以http://www.candland.net/blog/2009/06/08/NServiceBusDistributorOverview.aspx所述的方式使用经销商。所以我的发布商配置看起来像

<MsmqTransportConfig
    InputQueue="client"
    ErrorQueue="error"
    NumberOfWorkerThreads="1"
    MaxRetries="5"
  />

  <UnicastBusConfig
    DistributorControlAddress=""
    DistributorDataAddress=""
    ForwardReceivedMessagesTo="">

    <MessageEndpointMappings>
      <!-- publishers don't need to set this for their own message types -->
      <add Messages="EnformMessages" Endpoint="distributordatabus@cgy1-web01" />
      </MessageEndpointMappings>
  </UnicastBusConfig>

订阅者配置,如

<MsmqTransportConfig
  InputQueue="EnformMessages"
  ErrorQueue="error"
  NumberOfWorkerThreads="1"
  MaxRetries="5"
  />

  <UnicastBusConfig
    DistributorControlAddress="distributorcontrolbus@cgy1-web01"

      DistributorDataAddress="distributordatabus@cgy1-web01">
    <MessageEndpointMappings>

      <!--<add Messages="EnformMessages" Endpoint="EnformMessages" />-->
    </MessageEndpointMappings>
  </UnicastBusConfig>

和经销商一样

<appSettings>
    <add key="NumberOfWorkerThreads" value="1"/>

    <add key="DataInputQueue" value="distributorDataBus"/>
    <add key="ControlInputQueue" value="distributorControlBus"/>
    <add key="ErrorQueue" value="error"/>
    <add key="StorageQueue" value="distributorStorage"/>

    <add key="NameSpace" value="http://www.UdiDahan.com"/> 
    <!-- relevant for a Serialization of "interfaces" or "xml" -->

    <add key="Serialization" value="xml"/>
    <!-- can be either "xml", or "binary" -->
  </appSettings>


  <MsmqTransportConfig
 InputQueue="distributorControlBus"
 ErrorQueue="error"
 NumberOfWorkerThreads="1"
 MaxRetries="5"
  />

  <UnicastBusConfig >
    <MessageEndpointMappings >

      <add Messages="EnformMessages" Endpoint="EnformMessages" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

似乎没有消息到来。事实上,经销商根本没有打印出任何东西。我在配置文件中添加了一个日志记录部分,希望它能产生一些输出但却什么都没有。

Nservicebus 2.0.0.768

1 个答案:

答案 0 :(得分:3)

在发布/订阅方案中,订阅者将邮件转发到审核队列,而不是发布者。此外,您已告知订阅者其发布者是“testqueue”,但您将发布者的输入队列指定为“EnformMessages”。这两个队列需要匹配。