﻿# Azure Storage Queues Delayed Delivery

<!-- Version variant: asqn_11; default: [/transports/azure-storage-queues/delayed-delivery.md](/transports/azure-storage-queues/delayed-delivery.md) -->



In versions 7.4 and above, the Azure Storage Queues transport no longer relies on the [timeout manager](/nservicebus/messaging/timeout-manager.md) to provide [delayed delivery](/nservicebus/messaging/delayed-delivery.md). Instead, the transport uses the same storage account to provide delayed delivery without needing an external persister.


## How it works

When an endpoint is started, the transport creates a storage table to store the delayed messages. To ensure a single copy of delayed messages is dispatched by any endpoint instance, a blob container is used for leasing access to the delayed messages table.

By default, the storage table and blob container names are constructed using a naming scheme that starts with the word `delays` followed by SHA-1 hash of the endpoint's name. For example, `delays2fd4e1c67a2d28fced849ee1bb76e7391b93eb12` where `2fd4e1c67a2d28fced849ee1bb76e7391b93eb12` is a SHA-1 hash of an endpoint name.

> [!WARNING]
> A delayed message whose dispatched form exceeds the Azure Storage Queue size limit can fail repeatedly when it is forwarded to the destination queue. If this affects the workload, [add a thumbs-up or share the use case on issue #993](https://github.com/Particular/NServiceBus.AzureStorageQueues/issues/993).

### Overriding table/container name

Delayed messages table and container names can be overridden with a custom name:

<!-- snippet: delayed-delivery-override-name -->

```cs
var transport = new AzureStorageQueueTransport("connection string");
transport.DelayedDelivery.DelayedDeliveryTableName = "myendpoint";

endpointConfiguration.UseTransport(transport);
```

<!-- endsnippet -->


### Disabling delayed delivery

Delayed delivery can be turned off to disable unnecessary Azure Storage table polling. Delayed delivery should **not** be turned off if any of the following features are required:

 * Deferred messages
 * Saga timeouts
 * Delayed retries

<!-- snippet: delayed-delivery-disabled -->

```cs
var transport = new AzureStorageQueueTransport("connection string", useNativeDelayedDeliveries: false);
endpointConfiguration.UseTransport(transport);
```

<!-- endsnippet -->


> [!NOTE]
> When making use of the table name override, make sure the table is unique per endpoint and not shared across multiple endpoints.

## Backward compatibility

When upgrading to a version of the transport that supports delayed delivery natively, it is safe to run with both native-delay and non-native-delay endpoints at the same time. Endpoints supporting native delayed delivery can send delayed messages to endpoints that are not yet aware of the native delay infrastructure. These endpoints can continue to receive delayed messages from non-native endpoints as well.



