I watched the Introduction to NServiceBus on Pluralsight and the presenter is using both MSMQ and RavenDB to store messages. Why is this? What are the benefits of storing messages in a database as well, instead of just MSMQ? Searching I have found many results on how to use RavenDB with NServiceBus, but not why you should do it.
1 Answers
NServiceBus itself uses RavenDb for persistence, not as a transport. So, I cannot see why you say that RavenDb is used to "save messages". It might be that you have seen ServicePulse using RavenDb to store messages, more about this below.
There are three basic types of persistence needed for different parts of NServiceBus:
- Saga data
- Timeouts
- Subscriptions
There are also two additional usages, that are not used as frequently:
- Outbox
- Gateway deduplication
All of them are described in the docs
You can use any supported persistence engine, including RavenDb, for those purposes. Since it is the document database, it is much easier to use for these purposes than, say, NHibernate persistence with a relational database.
I am not sure what exactly the video shows, but it might also be ServicePulse, which is a part of the Particular Platform but not the NServiceBus component itself. ServicePulse uses RavenDb for its own data storage (including messages).
RavenDb is not used as NServiceBus transport, at least not by Particular itself.