0
votes

We're running NServiceBus 4.6 in Azure worker roles using Azure Storage Queues as the transport.

We're happy storing NServiceBus related data (sagas, subscriptions, etc) using the default Azure table storage persisters.

However we'd like to store our business entities in RavenDB to take advantage of querying and Raven's other features.

Given Azure's lack of transaction support - what is the best way to configure NServiceBus and use Raven's IDocumentStore / IDocumentSession in our handlers. We want to ensure that we don't lose any data if an exception occurs.

Should we:

  • Use NServiceBus's IManageUnitsOfWork interface to open a DocumentSession in Begin() and then call SaveChanges() in End() if there was no exception. This is what we used to do with on-premise NServiceBus hosting and MSMQ, or

  • Open a new DocumentSession inside each of our handlers and explicitly call SaveChanges() as soon as possible. This option would require ensuring that all our handlers are idempotent.

  • Store everything in RavenDB, including business entities and NServiceBus data. This would avoid Azure table storage and hopefully store our data atomically.

What is the recommended configuration and is there anything else we need to consider?

1

1 Answers

0
votes

I would suggest to go with option #1 with a slight change - you need to use RavenHQ or your own RavenDB setup in Azure that is highly available. Option #3 sounds too complicated and unnecessary. NServiceBus data is already handled by transports (by leveraging Storage Tables). This documentation is close to what you want to do.