0
votes

I'm using the 2.5.0.1442 version of NserviceBus with the publisher and subscriber configuration and the setup works fine when running on my local machine. I can see the subscriber receiving messages and handling it but it is not receiving any messages when I publish to Windows 2008 R2 server. This is the configuration:

Using a web application to publish message and a window service to listen to the published message. Both the web app and the windows service are on the same server.

Publisher:

var bus = NServiceBus.Configure.WithWeb()
                .Log4Net()
                .DefaultBuilder()
                .XmlSerializer()
                .MsmqTransport()
                    .IsTransactional(true)
                    .PurgeOnStartup(false)
                .MsmqSubscriptionStorage()
                .UnicastBus()
                .CreateBus()
                .Start();

<MsmqTransportConfig InputQueue="tnt_publisherinput" ErrorQueue="tnt_error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
  <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>
<MsmqSubscriptionStorageConfig Queue="tnt_subscriptions" />

Subscriber:

NServiceBus.Configure.With() 
.Log4Net() 
.DefaultBuilder() 
.XmlSerializer() 
.UnicastBus() 
.LoadMessageHandlers();


<MsmqTransportConfig InputQueue="timetrace_subscriberinput" ErrorQueue="timetrace_error" NumberOfWorkerThreads="1" MaxRetries="1" />
<UnicastBusConfig>
  <MessageEndpointMappings>
    <add Messages="Tnt.Messages" Endpoint="tnt_publisherinput" />
  </MessageEndpointMappings>
</UnicastBusConfig>

When the service is started, there are completion messages sitting in both the publisher and the subscriber queues:

<?xml version="1.0" ?>
<Messages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.net/NServiceBus.Unicast.Transport">
  <CompletionMessage>
    <ErrorCode>0</ErrorCode>
  </CompletionMessage>
</Messages>

And this is a snippet from the log after the service has started:

.
.
.

2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Messages.ReadyMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Saga.ISagaMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Saga.TimeoutMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Grid.Messages.ChangeNumberOfWorkerThreadsMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Grid.Messages.GetNumberOfWorkerThreadsMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Grid.Messages.GotNumberOfWorkerThreadsMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Unicast.Transport.CompletionMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Unicast.Transport.SubscriptionMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message Tnt.Messages.UpdatedMessage has been allocated to endpoint tnt_publisherinput.
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Associated 'Tnt.Messages.UpdatedMessage' message with 'Tnt.UpdatedHandler' handler
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Associated 'NServiceBus.Grid.Messages.ChangeNumberOfWorkerThreadsMessage' message with 'NServiceBus.Grid.MessageHandlers.ChangeNumberOfWorkerThreadsMessageHandler' handler
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Associated 'NServiceBus.Grid.Messages.GetNumberOfWorkerThreadsMessage' message with 'NServiceBus.Grid.MessageHandlers.GetNumberOfWorkerThreadsMessageHandler' handler
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Associated 'NServiceBus.IMessage' message with 'NServiceBus.Grid.MessageHandlers.GridInterceptingMessageHandler' handler
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Associated 'NServiceBus.IMessage' message with 'NServiceBus.Sagas.Impl.SagaMessageHandler' handler
2014-12-12 14:20 DEBUG NServiceBus.Utils.MsmqUtilities - Checking if queue exists: timetrace_subscriberinput.
2014-12-12 14:20 DEBUG NServiceBus.Utils.MsmqUtilities - Checking if queue exists: timetrace_error.
2014-12-12 14:20 INFO  NServiceBus.Unicast.Transport.Msmq.MsmqTransport - You are running a community edition of the software which only supports one thread.
2014-12-12 14:20 INFO  NServiceBus.Unicast.UnicastBus - Subscribing to Tnt.Messages.UpdatedMessage, Tnt.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null at publisher queue tnt_publisherinput
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Sending message NServiceBus.Unicast.Transport.CompletionMessage, NServiceBus.Core, Version=2.5.0.1442, Culture=neutral, PublicKeyToken=9fc386479f8a226c with ID 230d6ed0-8ed1-4405-a5a1-f89c5eb0b959\219324 to destination tnt_publisherinput.
ToString() of the message yields: NServiceBus.Unicast.Transport.CompletionMessage
Message headers:
SubscriptionMessageType:Tnt.Messages.UpdatedMessage, Tnt.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, EnclosedMessageTypes:
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Calling 'HandleBeginMessage' on NServiceBus.SagaPersisters.NHibernate.NHibernateMessageModule
2014-12-12 14:20 INFO  NServiceBus.Unicast.UnicastBus - timetrace_subscriberinput initialized.
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Calling 'HandleEndMessage' on NServiceBus.SagaPersisters.NHibernate.NHibernateMessageModule

But whenever I send a message through the web app, nothing happens (I verified that the message is actually being published from the web app and that the message assembly name is correct). There are no errors and nothing is recorded in the log. I've turned on journal on the queues and there are no messages except the completion messages. Not sure what else needs to be configured.

Please help.

2

2 Answers

1
votes

Do you change the endpoint mapping of the subscriber to point to the remote server?

i.e. <MessageEndpointMappings> <add Messages="Tnt.Messages" Endpoint="tnt_publisherinput@servername" /> </MessageEndpointMappings>

Why are you using such an old version of NServiceBus?

NOTE: If you are using a web server as a publisher, you will only be able to have one logical publisher, so if you are scaling your web tier you might consider building a subscription manager (a process managing all your subscriptions centrally for the web tier)

0
votes

What made it work was to uninstall MSMQ and re-install it without the "Active Directory Integration" option on the server. After restarting the server, everything was working fine.

Thanks for your time and responses Sean Farmar.