tencent cloud

TDMQ for RabbitMQ

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Introduction and Selection of the TDMQ Product Series
What Is TDMQ for RabbitMQ
Strengths
Use Cases
Description of Differences Between Managed Edition and Serverless Edition
Open-Source Version Support Description
Comparison with Open-Source RabbitMQ
High Availability
Use Limits
TDMQ for RabbitMQ-Related Concepts
Regions
Related Cloud Services
Billing
Billing Overview
Pricing
Billing Example
Convert to Monthly Subscription from Hourly Postpaid
Renewal
Viewing Consumption Details
Overdue Payments
Refund
Getting Started
Getting Started Guide
Step 1: Preparations
Step 2: Creating a RabbitMQ Cluster
Step 3: Configuring a Vhost
Step 4: Using the SDK to Send and Receive Messages
Step 5: Querying a Message
Step 6: Deleting Resources
User Guide
Usage Process Guide
Configuring the Account Permission
Creating a Cluster
Configuring a Vhost
Connecting to the Cluster
Managing Messages
Configure Advanced Feature
Managing the Cluster
Viewing Monitoring Data and Configuring Alarm Policy
Use Cases
Use Instructions of Use Cases
RabbitMQ Client Use Cases
RabbitMQ Message Reliability Use Cases
Usage Instructions for MQTT Protocol Supported by RabbitMQ
Migrate Cluster
Migrating RabbitMQ to Cloud
Step 1. Purchasing a TDMQ Instance
Step 2: Migrating Metadata to the Cloud
Step 3: Enabling Dual Read-Write
API Reference (Managed Edition)
API Overview
API Reference (Serverless Edition)
History
Introduction
API Category
Making API Requests
Relevant APIs for RabbitMQ Serverless PAAS Capacity
RabbitMQ Serverless Instance Management APIs
Data Types
Error Codes
SDK Documentation
SDK Overview
Spring Boot Starter Integration
Spring Cloud Stream Integration
Java SDK
Go SDK
Python SDK
PHP SDK
Security and Compliance
Permission Management
Network Security
Deletion Protection
Change Records
CloudAudit
FAQs
Service Level Agreement
Contact Us

Configuring a Priority Queue

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-01-04 15:02:28
Priority queues are a special type of queue in RabbitMQ that allows messages to be consumed in a preset priority order. Unlike the first-in-first-out (FIFO) mechanism of classic queues, priority queues reorder messages based on their priority properties, ensuring that high-priority messages are obtained and processed first by consumers.

Core Features

Priority range: It supports 256 priority levels from 0 to 255, where a higher number indicates a higher priority.
Memory sorting: All messages are sorted by priority in memory, which may increase memory consumption.
Performance impact: The sorting operation incurs additional CPU overheads.
Hybrid mode: It can be used in combination with features such as persistence and TTL.

Scenarios

Urgent task processing: For example, in e-commerce systems, order cancellation requests (high-priority) should be processed before ordinary orders (low-priority).
Alarm system: Different levels of alarm messages (CRITICAL > WARNING > INFO) require differentiated processing.
VIP customer service: Messages from high-level customers are assigned a higher priority.
Resource scheduling: Critical background tasks have priority access to computing resources.

Constraints and Limitations

Only Managed Edition clusters support configuring priority queues. Serverless Edition clusters do not currently support configuring them.

Configuring a Message Priority Range for Queues

When creating a queue, set the maximum priority for messages in the queue in Other Advanced Options. For specific steps, see Creating a Queue.
Set the maximum priority for messages in this queue, with an optional range of [0, 255]. Higher values incur greater sorting overheads.
After this parameter is configured, the priority feature is enabled. When sending messages, producers specify the priority level (between 0 and Maximum Priority) via the priority property. High-priority messages are consumed before lower-priority ones. The priority level of messages without a priority setting defaults to 0.


Sending a Priority Message

Take the Java client as an example to send messages with a priority property.
// Create message properties with a priority.
AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder()
.priority(5) // Set the priority to 5 (range: 0–255).
.deliveryMode(2) // Persistent messages.
.build();

// Send a message.
channel.basicPublish(
"exchange.direct", // Exchange name.
"priority.routing", // Routing Key.
properties, // Message properties.
"important order data".getBytes() // Message body.
);


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan