Configuration order for persistence

Component: NServiceBus
NuGet Package NServiceBus (7-pre)
This page targets a pre-release version and is subject to change prior to the final release.

When configuring persistence order is very important. The last configured persistence option wins.

Example 1

In this example the last configuration option will override all previous options.

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

endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();

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

Example 2

In this example all configuration options are explicit.

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

endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();

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

Example 3

This example sets the default persistence first thing and then overrides more explicit options.

endpointConfiguration.UsePersistence<RavenDBPersistence>();

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

endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();

Last modified