---
title: "Vhosts and queues"
description: "Manage RabbitMQ virtual hosts, queues, exchanges, bindings and policies, and choose a vhost's default queue type."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Vhosts and queues

A RabbitMQ cluster's **Vhosts**, **Queues**, **Exchanges**, **Bindings** and **Policies** tabs list
everything in the broker: what you created through EZGH (**Created in EZGH**, `origin: api`) and what
apps declared themselves (**Created by app**, `origin: broker`). You can delete either kind. EZGH never
deletes an object you didn't ask it to.

Each object, and each list, has `observedAt`: the time the cluster reported it.

## Vhosts

Every cluster has the default vhost, `/`, which API paths call `default`. The CLI's `--vhost` takes `/`
and is `/` when left out. Create more for separate
apps:

```sh
ezgh hosted-queues vhosts create hqc_4k2m9x0a7qpe airflow --wait
```

A vhost has `defaultQueueType` and `limits` (`maxQueues`, `maxConnections`). Vhosts are created only
through EZGH; `default` is reserved as a name. Deleting a vhost that has queues is refused unless you
pass `--force`, which deletes its queues and their messages.

Give a user access to a vhost in its [permissions](/hosted-queues/users#rabbitmq-permissions).

### Default queue type

New queues are quorum queues unless the app declares another type: each vhost's `defaultQueueType` is
`quorum`. A queue an app declares with `x-queue-type` gets that type. For an app that needs classic
queues, set its vhost to `classic`:

```sh
ezgh hosted-queues vhosts update hqc_4k2m9x0a7qpe legacy --default-queue-type classic --wait
```

Celery 5.5 and later uses quorum queues once it's configured for them. See
[Connect Celery](/hosted-queues/connect-celery).

## Queues

```sh
ezgh hosted-queues queues list hqc_4k2m9x0a7qpe
ezgh hosted-queues queues create hqc_4k2m9x0a7qpe jobs --wait
```

A queue has `type` (`quorum`, `classic` or `stream`), `durable`, `arguments`, `messages` and
`consumers`. Exclusive and auto-delete queues, such as those clients declare for replies, come and go
with their connections; the console hides them unless you show them.

Purge a queue to delete its messages, or delete the queue:

```sh
ezgh hosted-queues queues purge hqc_4k2m9x0a7qpe jobs --wait
ezgh hosted-queues queues delete hqc_4k2m9x0a7qpe jobs --wait
```

## Exchanges and bindings

```sh
ezgh hosted-queues exchanges create hqc_4k2m9x0a7qpe events --type topic --wait
ezgh hosted-queues bindings create hqc_4k2m9x0a7qpe --source events --destination jobs \
  --destination-type queue --routing-key "orders.*" --wait
```

Exchange types are `direct`, `fanout`, `topic`, `headers` and `x-consistent-hash`. A binding has
`source`, `destination`, `destinationType` (`queue` or `exchange`), `routingKey` and `arguments`, and is
addressed by the `key` EZGH gives it. The `amq.*` exchanges are listed and can't be changed.

## Policies

```sh
ezgh hosted-queues policies create hqc_4k2m9x0a7qpe jobs-limits --pattern "^jobs" \
  --apply-to queues --definition '{"max-length":100000,"dead-letter-exchange":"dlx"}' --wait
```

A policy has `pattern`, `applyTo`, `priority` and `definition`. `definition` takes `max-length`,
`max-length-bytes`, `message-ttl`, `expires`, `overflow`, `dead-letter-exchange`,
`dead-letter-routing-key`, `delivery-limit` and `queue-leader-locator`. Policies can change later.

## Names in the API

Queue and exchange names go in the URL path, percent-encoded: `a/b` as `a%2Fb`, `über.queue` as
`%C3%BCber.queue`. The CLI encodes them for you.

Source: https://docs.ezghcloud.com/hosted-queues/vhosts/index.mdx
