Updated on 2024-10-25 GMT+08:00

Creating a RabbitMQ Queue

Queues store messages. Each message is sent to one or multiple queues. Producers produce and send messages to queues, and consumers pull messages from queues for consumption.

Multiple consumers can subscribe to one queue. In this case, messages in the queue are distributed to the consumers, and no consumer can have all messages.

This section describes how to create a queue on the console.

Prerequisites

A virtual host has been created.

Creating a RabbitMQ Queue

  1. Log in to the console.
  2. In the upper left corner, click and select a region.

    Select the region where your RabbitMQ instance is.

  3. Click and choose Middleware > Distributed Message Service for RabbitMQ to open the console of DMS for RabbitMQ.
  4. Click an instance name to go to the instance details page.
  5. In the navigation pane, choose Virtual Hosts.
  6. Click a virtual host name.
  7. On the Queue tab page, click Create Queue. The Create Queue dialog box is displayed.
  8. Configure the queue name and other parameters by referring to Table 1.

    Table 1 Queue parameters

    Parameter

    Description

    Name

    When creating a queue, you can modify the automatically generated queue name. Naming rules: 3–128 characters and only letters, digits, percent signs (%), vertical bars (|), hyphens (-), underscores (_), slashes (/), or backslashes (\).

    The name cannot be changed once the queue is created.

    Persistence

    This parameter is mandatory for RabbitMQ 3.x.x instances, and enabled by default for RabbitMQ AMQP-0-9-1 instances.

    Indicates whether to enable queue persistence.
    • Enabled: The queue survives after server restart.
    • Disabled: The queue will be deleted after server restart and needs to be recreated.

    Auto-Delete

    Indicates whether to enable automatic queue deletion.

    • Yes: The queue will be automatically deleted when the last consumer unsubscribes from the queue.
    • No: The queue will not be deleted when the last consumer unsubscribes from the queue.

    Dead Letter Exchange

    Select an exchange for dead letter messages.

    Dead Letter Routing Key

    Enter a dead letter message routing key. The dead letter exchange sends dead letter messages to the queue with a binding key that corresponds to this routing key.

    Time to Live

    Indicates how long messages can remain, in ms. If the time to live passed and messages are still not consumed, they become dead letter messages and are sent to the dead letter exchange.

    Highest Priority

    Only RabbitMQ AMQP-0-9-1 has this parameter.

    Priority of a queue. Range: 1–9. The larger the value, the higher the priority.

    Lazy Queue

    Only available for RabbitMQ 3.x.x instances.

    Enter lazy to make the queue lazy.

    Lazy queues store as many messages to the disk as possible. Messages are loaded to the memory only when they are being consumed. This reduces memory consumption.

  9. Click OK.

    View the created queue on the Queue tab page.