tags:

views:

320

answers:

1

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"/&gt; 
    <!-- 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

A: 

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.

Udi Dahan
So then the ForwardRecievedMessagesTo is really just for auditing and shouldn't be used to distribute messages in the way I am attempting. testqueue was just for when I was pasting into the question. It is EnformMessages in reality
stimms
Reading some more it seems like I shouldn't be using the remote queue features of MSMQ 4 for various reasons. I guess I'll try the distributor out again.
stimms
Okay, some progress. Deploying the distributor on the listener machine along with a listener seems to show that the listener is connected to the the distributor. Now how does one get messages to the distributor?
stimms