Configuration order for persistence

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

When configuring persistence, order is important. The last-configured persistence option will be the one used by the endpoint.

Example 1

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

7.x NServiceBus
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.

7.x NServiceBus
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 initially, then overrides more explicit options.

7.x NServiceBus
endpointConfiguration.UsePersistence<RavenDBPersistence>();

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

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

Last modified