Configuration order for persistence

Component: NServiceBus | Nuget: NServiceBus (Version: 6.x)

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.

Edit
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.

Edit
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.

Edit
endpointConfiguration.UsePersistence<RavenDBPersistence>();

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

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

Last modified