3
votes

I recently upgraded my publisher/subscriber solution to NServiceBus version 3.2.2 using Nuget. My NServiceBus publisher and subscriber are both self-hosted.

Publisher code:

I start the NServiceBus publisher using NServiceBus.Host.exe (debug start action - start external program in project property).

app.config:

<?xml version="1.0" encoding="utf-8"?>
 <configuration>
  <configSections>
    <section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig,  NServiceBus.Core" />
    <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
    <section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
  </configSections>
  <MsmqTransportConfig ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
  <UnicastBusConfig ForwardReceivedMessagesTo="">
    <MessageEndpointMappings></MessageEndpointMappings>
  </UnicastBusConfig>
  <MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
</configuration>

EndpointConfig.cs:

namespace TrackEventPublisher.EventPublisher
{
   [EndpointName("EventPublisher")]
   public class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher
   {
   }
}

I ran into the following error when running the publisher:

Exception when starting endpoint, error has been logged. Reason: An exception was thrown while invoking the constructor 'Void .ctor(Raven.Client.IDocumentStore)' on type 'RavenTimeoutPersistence'.

StackTrace:

at NServiceBus.Hosting.GenericHost.Start() in d:\BuildAgent-03\work\nsb.master22\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 45 at NServiceBus.Hosting.Windows.WindowsHost.Start() in d:\BuildAgent-03\work\nsb.master22\src\hosting\NServiceBus.Hosting.Windows\WindowsHost.cs:line 56 at NServiceBus.Hosting.Windows.Program.<>c_DisplayClass8.b_4(WindowsHost service) in d:\BuildAgent-03\work\nsb.master22\src\hosting\NServiceBus.Hosting.Windows\Program.cs:line 95 at Topshelf.Internal.ControllerDelegates1.StartActionObject(Object obj) in d:\dev\open-source\topshelf\src\Topshelf\Internal\ControllerDelegates.cs:line 18 at Topshelf.Internal.IsolatedServiceControllerWrapper1.<>c_DisplayClass2.b_1(TService service) in d:\dev\open-source\topshelf\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65 at Topshelf.Internal.ServiceController1.<.cctor>b__1(ServiceController1 sc) in d:\dev\open-source\topshelf\src\Topshelf\Internal\ServiceController.cs:line 35 at Magnum.StateMachine.LambdaAction1.Execute(T instance, Event event, Object parameter) in :line 0 at Magnum.StateMachine.EventActionList1.Execute(T stateMachine, Event event, Object parameter) in :line 0

What might cause this error?
Can anyone tell me what is wrong with my endpoint configuration?

My solution worked great with an earlier version of NServiceBus (pre version 3.0).

Update: Here is the inner exception message: "Unable to connect to the remote server"

Is the Raven server started automatically by NServiceBus? It would appear that it is not running on my machine...

Update Well, for some reason the RavenDB service was not running on my machine - although it is set to start automatically. My solution is working correctly now. I guess I had to learn about the RavenDB the hard way :).

Has anyone out there had problems running the RavenDB service?

Update

Now that I have my service up and running, I try and run it on a different machine. The msmq folders are not created, and I get an error that the RavenDB is not available. In fact, RavenDB service is not installed after I ran my solution on a different windows OS machine. I tried running the "RunMeFirst.bat" that posted with version 3.2.2. However, the bat file attempts to install an extension with visual studio. Another error is posted if visual studio is installed, but Nuget extension is not installed.

Is there a better way to enable NServiceBus.Host.exe to install the RavenDB server and msmq folders without an instance of visual studio installed on the Windows OS machine?

Update

Wow, most updates ever! I added the following class to my publisher project which successfully created the msmq folders:

   class MsmqTransportConfigOverride : IWantCustomInitialization, INeedToInstallInfrastructure<Windows>
   {
      public void Init()
      {
       Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install();
      }

      public void Install(System.Security.Principal.WindowsIdentity identity)
      {
      }
   }

This new class which implements the IWantCustomIntialization interface seems to work great. However, I am still struggling to update my publisher to install the RavenDB on the windows host machine. I know there is a commandline prompt out there that can facilitate this, but is there another way? I tried to implement INeedToInstallInfrastructure interface, but I cannot find any examples out there. Does anyone have any ideas?

1

1 Answers

2
votes

We only run the installers if you: 1. Install the endpoint as a windows service (if running in the production profile => the default) 2. Run in debug mode 3. Run in the integration/lite profiles

So that would explain why the queues are not created (assuming none of the above is true for you?)