3

Is there anyway to use NServicebus 4 without installing RavenDB? We are using 2.5 and I would like to upgrade to 4 but this will be a tough sell if we have to install RavenDB on our production server. Is there any work around?

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
Raif
  • 8,641
  • 13
  • 45
  • 56

1 Answers1

9

Yes. You can use NServiceBus without RavenDB. While, the default subscription storage (for pub/sub), default saga persister and default timeout persister is RavenDB, using custom initialization like shown below, you can switch them to NHibernate persistence instead, in which case you won't need RavenDB.

class CustomInit : INeedInitialization
{
    public void Init()
    {
        Configure.Instance.UseNHibernateSubscriptionPersister();
        Configure.Instance.UseNHibernateSagaPersister();
        Configure.Instance.UseNHibernateTimeoutPersister();
    }
}

And also the app.config for using NHibernate is further simplified in 4.x

         <connectionStrings>
<add name="NServiceBus/Persistence" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=nservicebus;Integrated Security=True"/>

and specify the other needed NHibernate settings like below in appSettings:

    <appSettings>
<!-- dialect is defaulted to MsSql2008Dialect, if needed change accordingly -->
<add key="NServiceBus/Persistence/NHibernate/dialect" value="NHibernate.Dialect.MsSql2008Dialect" />
<!-- other optional settings examples -->
<add key="NServiceBus/Persistence/NHibernate/connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="NServiceBus/Persistence/NHibernate/connection.driver_class" value="NHibernate.Driver.Sql2008ClientDriver" />

Indu Alagarsamy
  • 449
  • 2
  • 4
  • 5
    An even terser option is NHibernatePersistence.UseAsDefault(); – Andreas Öhlund Aug 10 '13 at 19:11
  • I'm sure this is the correct answer but I think I may have deeper problems. I have a publisher modeled after the PubSub.sln in the samples folder that nsb installed. However, I have changed it to structuremap and to point to the message that I plan to send. I ammended the EPConfig to use NHP.Useasdefault() and the app.config as recommended above except I pointed it to my local. Now when I debug it starts to consoles and just hangs. Doesn't hit any breakpoints. ug. any thoughts? – Raif Aug 12 '13 at 14:47
  • I have to table this for now so I'll mark you as the correct answer. Thanks for your help – Raif Aug 13 '13 at 15:44
  • I found that if the tables do not exist in the database, they are not created. Is there a recommended way to create those? I ended up manually executing installers from NServiceBus.NHibernate DLL from test EXE to create tables. After that I continuously get primary key violation exceptions, but things work nonetheless. – Sergey Barskiy Apr 08 '14 at 17:45