Solutions    |    Downloads    |    License    |    Documentation    |    Training    |    Support    |    Customers    |    About Us

Using RavenDB In NServiceBus – Connecting

Last Updated: Nov 28, 2012 10:59AM IST

Beginning NServiceBus Version 3.0, RavenDB is one on the available mechanism in which NServiceBus may persist its information: timeouts, Sagas and subscriptions.

To tell NServiceBus to use Raven for persistence is a easy as calling Configure.RavenPersistence(). This is the default configuration and it uses the following conventions:

  1. If no master node is configured it will assume that a Raven server is running at http://localhost:8080, the default url for RavenDB.
  2. If a master node is configured the url used will be: http://{masternode}/:8080
  3. If a connection string named “NServiceBus.Persistence” is found the value of the connectionString attribute will be used.

  4. This pretty much give you full control over which Raven server your endpoint will use

If NServiceBus detects that any of the Raven related storage’s is used, Saga, Subscription, Timeouts, etc the above will be automatically configured for you. So in essence there should be no need for you to explicitly configure Raven unless you need to override the defaults.

Overriding the defaults

There are a few situations where the default behavior might not be good enough for you.

  • You want to use your own connection string - If you’re using Raven for your own data as well you might want to share connection string. You do this by using the Configure.RavenPersistence(string connectionString) signature. This tells NServiceBus to connection to the server specified in that string. The default connection string for RavenDB is “RavenDB”.
  • You want to specify a explicit database name –If you want to control the database name in code instead of configuration you would use the  Configure.RavenPersistence(string connectionString, string databaseName) signature. This could be useful in multi tenant scenario

What database will be used?

After connecting to a Raven server we need to decide which actual database to use. Unless we find a default database specified in the connection string NServiceBus will use the endpoint name as the database name. So if your endpoint is named “MyServer” the database name will be “MyServer”. Each endpoint will have a separate database unless you explicitly override using the connection string. RavenDB will automatically create the database if it doesn’t already exist.

A detailed explanation of the endpoint name concept can be found here and in this FAQ entry.

Can I use the IDocumentStore used by NServiceBus for my own data?

No, the Raven client is merged and internalized into the NServiceBus assemblies so if you want to use Raven for your own purposes you need to reference the Raven client and setup your own document store.

How do I look at the data?

Just open a web browser and type the url of the Raven server, this will open up the Raven DB management studio.

Where to go from now?

You can continue reading about installing RavenDB in NService bus, or about unit of work implementation for RavenDB.

About NServiceBus    |    Contact Us    |    Privacy    |    Follow us on:   
Copyright 2010-2013 NServiceBus. All rights reserved
NSB_Y@yahoo.com
http://assets2.desk.com/r1046ffeaa2233e531563a32d7edef6677d8a78b5/javascripts/
nservicebus
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
true
Invalid characters found
/customer/portal/articles/autocomplete
There was an error contacting Get Satisfaction
View All
0
discussions
replies
Questions
Ideas
Problems
Praise