开发者

Forwarding Messages to Remote Endpoint in Nservicebus

开发者 https://www.devze.com 2022-12-21 19:16 出处:网络
In my message publisher configuration I have <MsmqTransportConfig InputQueue=\"EnformMessages\" ErrorQueue=\"error\"

In my message publisher configuration I have

 <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>

which I was hoping would copy the messages published to EnformMessages to a queue on a remote machine. No messages ever seem to be sent to the remote machine although messages are certainly being received locally. The remote listener's config file looks like

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

  <UnicastBusConfig>
    <MessageEndpointMappings>

      <add Messages="EnformMessages" Endpoint="testqueue" />
    </MessageEndpointMappings>
开发者_高级运维  </UnicastBusConfig>

I also tried using the distributor in the fashion described at http://www.candland.net/blog/2009/06/08/NServiceBusDistributorOverview.aspx. So my publisher configuration looked like

<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>

Subscriber configuration like

<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>

and distributor like

<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>

No messages seem to arrive. In fact nothing is printed out by the distributor at all. I added a logging section to the config file in the hopes it would produce some output but got nothing.

Nservicebus 2.0.0.768


In a pub/sub scenario, it is the subscriber that will be forwarding messages to an audit queue, not the publisher. Also, you've told your subscriber that its publisher is "testqueue" but you specified your publisher's input queue as "EnformMessages". These two queues need to match up.

0

精彩评论

暂无评论...
验证码 换一张
取 消