views:

39

answers:

1

Scenario:

  • I'm using NServiceBus with MSMQ Transport.
  • I have messages from an app dropped into QUEUE-A.
  • I have a NServiceBus Gateway grab messages from QUEUE-A and send them to another Gateway
  • I the Destination Gateway receives the messages and places them into the respective queue.
  • Source Gateway throws a Null Reference Exception and send the messages 5 total times (max retries).
  • Destination Gateway receives all messages and shows that it's Sending the HTTP response in the log.

The error that the Destination Gateway throws is:

WARN NServiceBus.Unitcast.Transport.Msmq.MsmqTransport [(null)] <(null)> - Failed raising 'transport message received' event for message with ID=GUID System.NullReferenceException: Object reference not set to an instance of an object.

This error initially was setup on 2 different servers though it occurs when I run the scenario locally, under admin rights, on my local computer (just listening on different ports). I'm setting the SetHttpToHeader() of the message to the proper destination address.

The gateway configs are as follows:

Gateway1:

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

    <add key="InputQueue" value="Gateway1Pickup"/>
    <add key="ErrorQueue" value="Gateway1Error"/>
    <add key="ForwardReceivedMessageTo" value="audit"/>

    <add key="OutputQueue" value="Gateway1Output"/>
    <add key="ListenUrl" value="http://address:6768/Gateway/"/&gt;

    <add key="RequireMD5FromClient" value="true"/>
  </appSettings>

Gateway2:

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

    <add key="InputQueue" value="Gateway2Pickup"/>
    <add key="ErrorQueue" value="Gateway2Error"/>
    <add key="ForwardReceivedMessageTo" value="audit"/>

    <add key="OutputQueue" value="Gateway2Output"/>
    <add key="ListenUrl" value="http://address:6768/Gateway/"/&gt;

    <add key="RequireMD5FromClient" value="true"/>
  </appSettings>

Does anyone know where I'm going wrong on this?

+1  A: 

At first I got a solid repro and then I realized that NSB does not handle creating the Audit queues for you. If you remove them from the config or create the Audit queues, you should be all set.

Adam Fyles
The fact that I was missing the queue was one thing but I never would have expected the resulting behavior. Good find and thanks for the information!
JamesEggers