RabbitMQ Transport Scripting

Target Version:
NServiceBus 8.x
Standard support for version 8.x of NServiceBus has expired. For more information see our Support Policy.

To provision or deprovision the resources required by an endpoint, use the rabbitmq-transport command-line (CLI) tool. The tool can be obtained from NuGet and installed using the following command:

dotnet tool install -g NServiceBus.Transport.RabbitMQ.CommandLine

Once installed, the rabbitmq-transport command line tool will be available for use.

rabbitmq-transport <command> [options]

Available commands

Common options

Every command except delays verify connects to a broker using a connection string and accepts the following options. delays verify talks to the RabbitMQ management API instead, and takes its own options. See connection settings for the supported connection string formats.

--connectionString | -c : Force this command to use the specified connection string

--connectionStringEnv : Specifies the environment variable where the connection string can be found. --connectionString, if specified, will take precedence over this option. Default: RabbitMQTransport_ConnectionString

--certPath : The path to the client certificate file for connecting to the broker

--certPassphrase : The passphrase for the client certificate file specified by the certPath option

--useExternalAuth : Use the external authorization option when connecting to the broker

--disableCertValidation : Disable remote certificate validation when connecting to the broker

delays create

Use this command to create v2 delay infrastructure queues and exchanges:

rabbitmq-transport delays create [options]

This command takes only the common options.

delays migrate

Use this command to migrate in-flight delayed messages from the v1 delay infrastructure to the v2 delay infrastructure:

rabbitmq-transport delays migrate [options]

Both infrastructures live on the same broker, so this command uses a single connection string.

Messages that are missing the headers needed to calculate a new delivery time cannot be migrated. The command moves them to a delays-migrate-poison-messages queue on the same broker so that they can be inspected and handled separately.

Options

In addition to the common options:

--routingTopology | -r : The routing topology to use. Valid values are Conventional and Direct. Default: Conventional

delays verify

Use this command to verify broker requirements for using the v2 delay infrastructure:

rabbitmq-transport delays verify [options]

The command checks that the broker is at least version 3.10.0 and that the stream_queue and quorum_queue feature flags are enabled, then reports either All checks OK or the first requirement that was not met. Use it to confirm a broker is suitable before provisioning anything on it.

Options

This command does not use a connection string, and all three of its options are required.

--url : The URL of the RabbitMQ management API

--username : The username for accessing the RabbitMQ management API

--password : The password for accessing the RabbitMQ management API

endpoint create

Use this command to create queues and exchanges for an endpoint:

rabbitmq-transport endpoint create <endpointName> [options]

Arguments

endpointName : The name of the endpoint to create

Options

In addition to the common options:

--routingTopology | -r : Specifies which routing topology to use. Valid values are Conventional and Direct. Default: Conventional

--useDurableEntities | -d : Specifies if entities should be created as durable. Default: true

--queueType | -t : Specifies the queue type to use for queue creation. Valid values are Classic and Quorum. Default: Quorum

--errorQueueName : Also create an error queue with the specified name

--auditQueueName : Also create an audit queue with the specified name

--instanceDiscriminators : An optional list of instance discriminators to use when the endpoint needs uniquely addressable instances

queue migrate-to-quorum

Use this command to migrate an existing classic queue to a quorum queue.

rabbitmq-transport queue migrate-to-quorum <queueName> [options]

The migration moves the existing messages to a temporary holding queue, recreates the queue as a quorum queue, and then moves the messages back. If the command fails part way through, run it again: it detects the stage the previous run reached and continues from there.

Arguments

queueName : The name of the classic queue to migrate to a quorum queue

Options

This command takes only the common options.

Related Articles