RabbitMQ优先级队列的使用

配置:

  1. 创建交换机 priority_exchange。
  2. 创建队列 priority_queue,设置Arguments: x-max-priority: 5。

验证:

向队列 priority_queue 发送一条消息,设置Properties属性:priority=5,内容为5的消息和 priority=4,内容为4的消息。获取消息先取到priority=5的。