﻿# Creating queues

<!-- Version variant: core_9; default: [/transports/queuecreation.md](/transports/queuecreation.md) -->


> [!WARNING]
> NServiceBus will automatically request the transport to create queues needed if the [installers](/nservicebus/operations/installers.md) are enabled. This also includes queues needed by all declared [satellites](/nservicebus/satellites/index.md). Prefer using scripts to create custom queues instead of relying on interfaces provided by NServiceBus.

The scripting guidelines show how to take full control over queue creation:

* [SQLServer](/transports/sql/operations-scripting.md#create-queues)
* [MSMQ](/transports/msmq/operations-scripting.md#create-queues)
* [RabbitMQ](/transports/rabbitmq/operations-scripting.md)
* [Azure ServiceBus](/transports/azure-service-bus/operational-scripting.md)

## Declaration

Queues should be declared during the `Setup` phase of a [Feature](/nservicebus/pipeline/features.md).

A built-in example is the audit feature, which needs the audit queue. During start-up, NServiceBus ensures the declared queues are present and aborts the start-up procedure if they are not (with the exception of MSMQ remote queues, which are optional).

<!-- snippet: queuebindings -->

```cs
public class FeatureThatRequiresAQueue :
    Feature
{
    protected override void Setup(FeatureConfigurationContext context)
    {
        var queueBindings = context.Settings.Get<QueueBindings>();
        queueBindings.BindSending("someQueue");
    }
}
```

<!-- endsnippet -->

## Creation

Queues are created only during [installation](/nservicebus/operations/installers.md).
