This topic describes priority queues in ApsaraMQ for RabbitMQ, including their configuration and limits.
Feature description
This feature ensures that high-priority messages are consumed first when messages accumulate in a queue.
Prerequisites
To enable this feature, submit a ticket.
Only dedicated instances of ApsaraMQ for RabbitMQ support this feature.
Configuration
A client declares a priority queue by setting the x-max-priority parameter. The value for this parameter must be an integer from 1 to 10.
Channel ch = ...;
Map<String, Object> args = new HashMap<String, Object>();
args.put("x-max-priority", 10);
ch.queueDeclare("my-priority-queue", true, false, false, args);