RavenHQ NServiceBus connection string

311 views
Skip to first unread message

Sean Kearon

unread,
Jun 27, 2012, 2:10:25 PM6/27/12
to rav...@googlegroups.com
I have an NSB installation that I'm upgrading to NSB 3*.  I'd like to configure it to use RavenHQ, but I'm having problems with the connection string.  NSB has a default connection string, named NServiceBus.Persistence.  The connection string I'm using is:

<add name="NServiceBus.Persistence" connectionString="Url=https://1.ravenhq.com/databases/MyDB; ApiKey=myravenguidx-xxxx-xxxx-xxxx-xxxxxxxxxxx"/>

I am using the same connection string from a client and it connects fine.  The exception I am getting is a 400 bad request, as below.  

Am I missing something?  Is this an NSB issue? 

  Message=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'.
  Source=NServiceBus.Host
  StackTrace:
       at NServiceBus.Hosting.GenericHost.Start() in c:\TeamCity\buildAgent\work\nsb.master_3\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 45
       at NServiceBus.Hosting.Windows.WindowsHost.Start() in c:\TeamCity\buildAgent\work\nsb.master_3\src\hosting\NServiceBus.Hosting.Windows\WindowsHost.cs:line 56
       at NServiceBus.Hosting.Windows.Program.<>c__DisplayClass8.<Main>b__4(WindowsHost service) in c:\TeamCity\buildAgent\work\nsb.master_3\src\hosting\NServiceBus.Hosting.Windows\Program.cs:line 97
       at Topshelf.Internal.ControllerDelegates`1.StartActionObject(Object obj) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ControllerDelegates.cs:line 18
       at Topshelf.Internal.IsolatedServiceControllerWrapper`1.<>c__DisplayClass2.<set_StartAction>b__1(TService service) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65
       at Topshelf.Internal.ServiceController`1.<.cctor>b__1(ServiceController`1 sc) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceController.cs:line 35
       at Magnum.StateMachine.LambdaAction`1.Execute(T instance, Event event, Object parameter) in :line 0
       at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event, Object parameter) in :line 0
  InnerException: Autofac.Core.DependencyResolutionException
       Message=An exception was thrown while invoking the constructor 'Void .ctor(Raven.Client.IDocumentStore)' on type 'RavenTimeoutPersistence'.
       Source=NServiceBus.Core
       StackTrace:
            at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
            at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
            at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
            at Autofac.Core.Resolving.InstanceLookup.<Execute>b__6()
            at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
            at Autofac.Core.Resolving.InstanceLookup.Execute()
            at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
            at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
            at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
            at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
            at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
            at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
            at Autofac.Core.Activators.Reflection.AutowiringPropertyInjector.InjectProperties(IComponentContext context, Object instance, Boolean overrideSetValues)
            at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClassd.<PropertiesAutowired>b__c(Object s, ActivatingEventArgs`1 e)
            at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
            at Autofac.Core.Registration.ComponentRegistration.RaiseActivating(IComponentContext context, IEnumerable`1 parameters, Object& instance)
            at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
            at Autofac.Core.Resolving.InstanceLookup.<Execute>b__6()
            at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
            at Autofac.Core.Resolving.InstanceLookup.Execute()
            at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
            at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
            at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass4.<>c__DisplayClass6.<RegistrationsFor>b__1(IComponentRegistration cr)
            at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
            at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
            at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
            at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass4.<RegistrationsFor>b__0(IComponentContext c, IEnumerable`1 p)
            at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
            at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
            at Autofac.Core.Resolving.InstanceLookup.Execute()
            at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
            at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
            at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
            at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
            at Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
            at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
            at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
            at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
            at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
            at NServiceBus.ObjectBuilder.Autofac.Internal.ContainerExtensions.ResolveAll(IComponentContext container, Type componentType)
            at NServiceBus.ObjectBuilder.Autofac.AutofacObjectBuilder.BuildAll(Type typeToBuild)
            at NServiceBus.ObjectBuilder.Common.CommonObjectBuilder.<NServiceBus.ObjectBuilder.IBuilder.BuildAll>d__1`1.MoveNext()
            at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
            at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
            at NServiceBus.Unicast.Config.StartupRunners.<Run>b__4(Object obj, EventArgs ev)
            at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start(Action startupAction)
            at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start()
            at NServiceBus.Hosting.GenericHost.Start() in c:\TeamCity\buildAgent\work\nsb.master_3\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 32
       InnerException: System.InvalidOperationException
            Message=""
            Source=NServiceBus.Core
            StackTrace:
                 at Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func`1 getResponse)
                 at Raven.Client.Connection.HttpJsonRequest.ReadResponseString()
                 at Raven.Client.Connection.HttpJsonRequest.ExecuteRequest()
                 at Raven.Client.Connection.ServerClient.DirectPutIndex(String name, String operationUrl, Boolean overwrite, IndexDefinition definition)
                 at Raven.Client.Connection.ServerClient.<>c__DisplayClass34.<PutIndex>b__33(String operationUrl)
                 at Raven.Client.Connection.ServerClient.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T& result)
                 at Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation)
                 at Raven.Client.Connection.ServerClient.PutIndex(String name, IndexDefinition definition, Boolean overwrite)
                 at Raven.Client.Connection.ServerClient.PutIndex[TDocument,TReduceResult](String name, IndexDefinitionBuilder`2 indexDef, Boolean overwrite)
                 at NServiceBus.Timeout.Hosting.Windows.Persistence.RavenTimeoutPersistence..ctor(IDocumentStore store)
            InnerException: System.Net.WebException
                 Message=The remote server returned an error: (400) Bad Request.
                 Source=System
                 StackTrace:
                      at System.Net.HttpWebRequest.GetResponse()
                      at Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func`1 getResponse)
                 InnerException: 
  

Sean Kearon

unread,
Jun 27, 2012, 2:12:16 PM6/27/12
to rav...@googlegroups.com
 BTW, the intent is to use a single RavenHQ DB for NSB timeouts, sagas and subscriptions, which would be very nice!

Oren Eini (Ayende Rahien)

unread,
Jun 27, 2012, 3:27:29 PM6/27/12
to rav...@googlegroups.com
Sean,
The NSB client uses build 616, which I don't believe had support for api-key

Sean Kearon

unread,
Jun 27, 2012, 5:41:18 PM6/27/12
to rav...@googlegroups.com
So, does that mean that the current NSB 3.2.3 doesn't support RHQ, or is there a way to adjust the connection string to allow access?  Andreas has indicated that this is a supported configuration from the NSB perspective.

Oren Eini (Ayende Rahien)

unread,
Jun 28, 2012, 12:48:27 AM6/28/12
to rav...@googlegroups.com
You need to manually setup the api key in 616, it won't be read properly from the connection string

Sean Kearon

unread,
Jun 29, 2012, 2:56:11 AM6/29/12
to rav...@googlegroups.com
In case anyone else is trying to do this from NSB 3.2.3, it turns out there is not way to set the API key with that version of NSB.  You need to use the latest NSB-CI builds or wait until the next release.
Reply all
Reply to author
Forward
0 new messages