Learning Persistence

Project Hosting | Nuget: NServiceBus (Version: 6.x)

The Learning Persistence simulates saga persistence infrastructure by storing data in the local file system. All files and directories are relative to the current project directory.

The Learning Transport and Learning Persistence are not for production use. They are designed for short term learning and experimentation purposes. It should also not be used for longer-term development, i.e. the same transport and persistence used in production should be used in development and debug scenarios. Select a production transport and persistence before developing features. Do not use the learning transport or learning persistence to perform any kind of performance analysis.

Added in Version 6.3.

Some recommended use cases are:

  • Learning/Experimenting with NServiceBus features.
  • Building a spike or demo.
  • Reproducing a bug that is not related to a production transport, for example when raising a support case.

Usage

Edit
endpointConfiguration.UsePersistence<LearningPersistence>();

Storage Directory

By default all data is stored in a .sagas directory that exists at AppDomain.CurrentDomain.BaseDirectory.

To configure the storage location:

Edit
var persistence = endpointConfiguration.UsePersistence<LearningPersistence>();
persistence.SagaStorageDirectory("PathToStoreSagas");

Each saga will be stored a sub-directory matching the saga type name with the saga data being serialized into a .json file named based on the saga Id.

Samples

Related Articles


Last modified