Azure Storage Queues Transport Configuration

Component: Azure Storage Queues Transport
NuGet NServiceBus.Azure.Transports.WindowsAzureStorageQueues (5.x)
Target NServiceBus Version: 4.x
Standard support for version 4.x of NServiceBus has expired. For more information see our Support Policy.

Configuration parameters

The Azure Storage Queues Transport can be configured using the following parameters:

ConnectionString

Defaults: UseDevelopmentStorage=true

PeekInterval

The amount of time that the transport waits before polling the input queue, in milliseconds. Defaults: 50 ms

MaximumWaitTimeWhenIdle

In order to save money on the transaction operations, the transport optimizes wait times according to the expected load. The transport will back off when no messages can be found on the queue. The wait time will be increased linearly, but it will never exceed the value specified here, in milliseconds.

Defaults: 1000 ms (i.e. 1 second)

PurgeOnStartup

Instructs the transport to remove any existing messages from the input queue on startup.

Defaults: false, i.e. messages are not removed when endpoint starts.

MessageInvisibleTime

The visibilitytimeout mechanism, supported by Azure Storage Queues, causes the message to become invisible after read for a specified period of time. If the processing unit fails to delete the message in the specified time, the message will reappear on the queue. Then another process can retry the message.

Defaults: 30000 ms (i.e. 30 seconds)

BatchSize

The number of messages that the transport tries to pull at once from the storage queue. Depending on the expected load, the value should vary between 1 and 32 (the maximum).

Defaults:

  • 10 in Version 6 and below
  • 32 in Version 7
QueueName and QueuePerInstance are obsoleted. Instead, use bus configuration object to specify the endpoint name and select a scale out option.

Settings can be overridden by adding to the web.config or the app.config files a configuration section:

<configSections>
   <section name="AzureQueueConfig"
            type="NServiceBus.Config.AzureQueueConfig, NServiceBus.Azure.Transports.WindowsAzureStorageQueues" />
</configSections>
<AzureQueueConfig ConnectionString="UseDevelopmentStorage=true" />

Note that the connection string can be also configured by specifying a value for connection string called NServiceBus/Transport, however this value will be overridden if another is provided in the configuration section:

<configuration>
  <connectionStrings>
     <add name="NServiceBus/Transport" connectionString="UseDevelopmentStorage=true" />
  </connectionStrings>
</configuration>

Connection strings

Note that multiple connection string formats apply when working with Azure storage services. When running against the emulated environment the format is UseDevelopmentStorage=true, but when running against a cloud hosted storage account the format is DefaultEndpointsProtocol=https;AccountName=myAccount;AccountKey=myKey;

For more details refer to Configuring Azure Connection Strings document.

Serialization

Azure Storage Queues Transport changes the default serializer to JSON. The serializer can be changed using the serialization API.

Related Articles


Last modified