1
votes

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

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

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

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

2
What version of NSB are you on?Andreas Öhlund
Version on NSB.Host is 2.0.0.1219JamesEggers
I'm using the .Net 4 build as well.JamesEggers
The gateway files are straight from the zip download for 2.0.0.1219, .net 4 build in the /processes/gateway/bin directory. Only difference is the config settings of course.JamesEggers

2 Answers

3
votes

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.

0
votes

I found this above problem showed up when I didn't have some dependent assemblies in the service directory. I found the error attached to the message in the MSMQ queue. I used Queue Explorer, but I presume other tools would show the same.