In NServiceBus.Persistence.AzureStorage XML-based configuration is no longer available. Configuring the behavior of the persister is done using the code configuration API.
For sagas, subscriptions and for timeouts:
var persistence = endpointConfiguration.UsePersistence<AzureStoragePersistence>();
persistence.ConnectionString("connectionString");
Saga configuration
var persistence = endpointConfiguration.UsePersistence<AzureStoragePersistence, StorageType.Sagas>();
persistence.ConnectionString("connectionString");
persistence.CreateSchema(true);
// Added in Version 1.4
persistence.AssumeSecondaryIndicesExist();
The following settings are available for changing the behavior of saga persistence section:
ConnectionString
: Sets the connection string for the storage account to be used for storing saga information.- NServiceBus.Persistence.AzureStorage version 1 and above defaults to
null
. CreateSchema
: Instructs the persister to create the table automatically. Defaults totrue
.AssumeSecondaryIndicesExist
(Added in version 1.4): Disables scanning for secondary index records when checking if a new saga should be created. A secondary index record was not created by the persister contained in theNServiceBus.
package. To provide backward compatibility, theAzure NServiceBus.
package performs a full table scan, across all partitions, for secondary index records before creating a new saga. For systems that have only used thePersistence. AzureStorage NServiceBus.
library, or have verified that all saga instances have a secondary index record, full table scans can be safely disabled by using this configuration setting.Persistence. AzureStorage
Subscription configuration
var persistence = endpointConfiguration.UsePersistence<AzureStoragePersistence, StorageType.Subscriptions>();
persistence.ConnectionString("connectionString");
persistence.TableName("tableName");
persistence.CreateSchema(true);
// Added in Version 1.3
persistence.CacheFor(TimeSpan.FromMinutes(1));
The following settings are available for changing the behavior of subscription persistence:
ConnectionString
: Sets the connection string for the storage account to be used for storing subscription information.- NServiceBus.Persistence.AzureStorage version 1 and above defaults to
null
. CreateSchema
: Instructs the persister to create the table automatically. Defaults totrue
.TableName
: Specifies the name of the table for storing subscriptions. Defaults toSubscription
.CacheFor
(Added in Version 1.3): By default every time a message is published the subscription storage is queried. In scenarios where the list of subscribers rarely changes, this query is often redundant and can slow down message processing.CacheFor
allows subscriptions to be cached for a given period of time, hence helping reduce the impact of redundant queries to the subscription store.
Timeout configuration
var persistence = endpointConfiguration.UsePersistence<AzureStoragePersistence, StorageType.Timeouts>();
persistence.ConnectionString("connectionString");
persistence.CreateSchema(true);
persistence.TimeoutManagerDataTableName("TimeoutManager");
persistence.TimeoutDataTableName("TimeoutData");
persistence.CatchUpInterval(3600);
persistence.PartitionKeyScope("yyyy-MM-dd-HH");
The following settings are available for changing the behavior of timeout persistence:
ConnectionString
: Sets the connection string for the storage account to be used for storing timeout information.- NServiceBus.Persistence.AzureStorage version 1 and above defaults to
null
. TimeoutManagerDataTableName
: Sets the name of the table where the timeout manager stores its internal state.- defaults to
TimeoutManagerDataTable
. TimeoutDataTableName
: Sets the name of the table where the timeouts themselves are stored. Defaults toTimeoutDataTableName
.CatchUpInterval
: When a node hosting a timeout manager goes down, it needs to catch up with missed timeouts faster than it normally would (1 sec); this value sets the catchup interval in seconds.- defaults to 3600, i.e. it will process one hour at a time.
PartitionKeyScope
: The time range used as partition key value for all timeouts. For optimal performance this should be in line with the catchup interval. Data in the table defined byTimeoutDataTableName
must be migrated when modifyingPartitionKeyScope
.- defaults to
yyyMMddHH
. TimeoutStateContainerName
: Sets the name of the container where the timeout state is stored - Added in NServiceBus.Persistence.AzureStorage version 1.0.- defaults to
timeoutstate
.
For more information on connection string configuration see Configuring Azure Connection Strings.