Book Image

MASTERING NSERVICEBUS AND PERSISTENCE

By : Richard L Helton
Book Image

MASTERING NSERVICEBUS AND PERSISTENCE

By: Richard L Helton

Overview of this book

Table of Contents (15 chapters)
Mastering NServiceBus and Persistence
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using saga and NHibernate


We will walk through a modified example of a basic saga, originally from https://github.com/jkillingsworth/NServiceBus-BasicSagas. However, this example has been modified to use NHibernate, which uses a local SQL Express database. NHibernate was added using some of the steps from http://docs.particular.net/nservicebus/relational-persistence-using-nhibernate. We also added logging using the NLog framework to log the functionality as we go. The NHibernate ORM framework was chosen because it can connect to a multitude of different databases using the same code, the difference being to the different databases is the connection string in the app.config file.

To elaborate on this Saga example, there is a MySaga program that directs the messages using message handlers that creates new messages to send and respond through the workflow. The saga object is persisting the message states to be used during these message handlers. The saga persistence keeps track of the information...