AI agents: use the documentation index at llms.txt to locate machine-readable pages. This section is indexed by https://docs.particular.net/persistence/llms.txt. The markdown version of this page is served as plain text. An MCP server at /mcp serves the same content via the search_docs and read_doc tools; it is read-only and needs no credentials. Markdown versions of documentation pages are available by appending .md to the page URL. Directory URLs use index.md. They are served as text/plain because some retrieval backends reject text/markdown.

Configuration Order for Persistence

Component:
NServiceBus
NuGet Package:
NServiceBus 10.x

When using different persistence options for storage types, the order of configuration is important. When specifying multiple persistence options for the same storage type, the last-configured option will be used. Using the generic UsePersistence<TPersistenceOption> (without specifying a storage type) applies the persistence to all its supported storage types.

Example 1

In this example, RavenDB persistence is used for all storage types as it overwrites the configuration for the outbox and subscription storage types.

endpointConfiguration.UsePersistence<NHibernatePersistence, StorageType.Outbox>();

// This one will override the above settings
endpointConfiguration.UsePersistence<RavenDBPersistence>();

Example 2

To avoid overwriting, all storage types can be explicitly configured using the UsePersistence<TPersistenceOption, TStorageType> API.

endpointConfiguration.UsePersistence<NHibernatePersistence, StorageType.Outbox>();

endpointConfiguration.UsePersistence<RavenDBPersistence, StorageType.Sagas>();
endpointConfiguration.UsePersistence<RavenDBPersistence, StorageType.Subscriptions>();

Example 3

Instead of explicitly defining all storage types, the generic persistence option can be specified before the explicit overwrites. In this example, RavenDB persistence will be used for all storage types except for the outbox and subscriptions.

endpointConfiguration.UsePersistence<RavenDBPersistence>();

endpointConfiguration.UsePersistence<NHibernatePersistence, StorageType.Outbox>();