Mi Galaxy EMQ Book

PriorityQueue is a queue that allows users to set the message priority. When creating, set the corresponding parametersenablePriorityto true.

Correspondingly, messages with priority information can be sent to the PriorityQueue. The priority range from high to low is [1, 16].

When using PriorityQueue users need to be clear about the following points:

  1. Message priority is local, not global. Local means that the priority is valid in a partition, not in the entire queue. When EMQ returns a Message, if there is a high-priority message in a selected partition these high-priority Messages will return first. However, if there is no high-priority message in a Partition it will return the highest-priority message in the partition first. At the same time, it is possible to have higher priority Messages in other partitions, but these Messages will not be returned.

  2. If the message required by the business is first-in-first-out, that is, global priority is required, it is recommended that the user re-order messages after consuming them.